Welcome Guest, Not a member yet? Register   Sign In
checkbox based input item
#11

(08-25-2018, 12:18 AM)Wouter60 Wrote: Give the inputs for the number of sets a name also: name="sets[]".
Remove the onChange part that you already have.

Then, in the jQuery part that starts with $(document).ready .. insert this:
Code:
    $("input[name='sets[]']").change(function(){
        row = $(this).parents('tr');
        n = $(this).val();
        f = row.find("input[name='india[]']").val();
        total = n * f;
        alert(total);
    });

Now, if you change any of the inputs with the name "sets[]", it will trigger a calculation.
Not working
************
echo '<td id="textone_'.$row['id'].'">'.$row['fee']. '</td>'; 
  echo '<td id="texttwo_'.$row['id'].'"> 
  <input type="number" min="0" max="999" name="india"  
   class="txtbox" disabled="disabled" ></td>';
   echo '<td> <input type="text" value="0"
   id="result_'.$row['id'].'" name="result"></td>';


<script src="//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> 
 <script type="text/javascript">
$(document).ready(function(){
$("input[name='sets[]']").change(function(){
        row = $(this).parents('tr');
        n = $(this).val();
        f = row.find("input[name='india[]']").val();
        total = n * f;
        alert(total);
    });

</script>
Reply


Messages In This Thread
checkbox based input item - by kvanaraj - 08-20-2018, 11:35 PM
RE: checkbox based input item - by Pertti - 08-21-2018, 12:28 AM
RE: checkbox based input item - by kvanaraj - 08-21-2018, 01:40 AM
RE: checkbox based input item - by Pertti - 08-21-2018, 02:02 AM
RE: checkbox based input item - by kvanaraj - 08-21-2018, 02:34 AM
RE: checkbox based input item - by kvanaraj - 08-24-2018, 12:54 AM
RE: checkbox based input item - by InsiteFX - 08-24-2018, 03:13 AM
RE: checkbox based input item - by Wouter60 - 08-24-2018, 07:41 AM
RE: checkbox based input item - by kvanaraj - 08-24-2018, 11:00 PM
RE: checkbox based input item - by Wouter60 - 08-25-2018, 12:18 AM
RE: checkbox based input item - by kvanaraj - 08-25-2018, 12:44 AM
RE: checkbox based input item - by Wouter60 - 08-25-2018, 02:54 PM



Theme © iAndrew 2016 - Forum software by © MyBB