javascript - Iterating through all selected checkboxes and get the value of input boxes in jquery -


this question has answer here:

i have code whereby in table row there checkboxes , input boxes, values of input boxes checkboxes checked

this html

<table> <tr> <td><input type="checkbox" name="new" value="37"></td> <td><input type="text" name="new" id="quantity" class="37"></td> </tr>   <tr>  <td><input type="checkbox" name="new" value="38"></td>  <td><input type="text" name="new" id="quantity" class="38"></td>  </tr>   .....#this continue    </table> 

note class of input boxes same value of checkboxes

currently using code check checked checkboxes

    var marked = new array();     var k = 0;     $('input:checked').each(function(index,value) {          marked[k] = value;         k++;         alert(k);     });             alert($('input[name="new"]:checked').serialize()); 

how can change return value of input boxes

try this:

$(document).ready(function(){         $( "input[type=checkbox]" ).each(function(){             if($(this).is(':checked'))             {                 var value = $(this).closest('tr').find($( "input[type=text]" )).val();                 alert(value);             }         });     }); 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -