Get selected drop-down value of a row in html table using javascript/jquery -


i have html table 4 columns , multiple rows

column1 : simple text column2 : simple text column3 : select list 2 values column4 : button performs operation 

at run time, want selected / entered values columns of row against column4 button clicked. know little of javascript/jquery.so, please help.

here static table code

<table id="invoicetbl" border="1">      <thead>         <tr>             <th>broker info</th>             <th>receivable amount</th>             <<th>status</th>                 <th>action</th>         </tr>     </thead>     <tbody></tbody> </table> 

and populating table i.e. inserting data on ajax call this:

$.ajax({     type: "post",     data: $('#searchdetails').serialize(),     async: false,     cache: false,     url: "/opsadmin/search.json",     datatype: 'json',     success: function (result) {         var = 1;         $.each(result, function (index, value) {             alert(index + ": " + value.brokerinfo);             $('table#invoicetbl tbody').append('<tr> <td>' + + '</td><td>' + value.brokerinfo + '</td><td>' + value.receivableamount + '</td><td><select name="act" id="s"><option>pending</option><option>cleared</option></select></td><td><input type="button" value="process" onclick="updatestatus(\'' + index + '\')"</input></td></tr>');             i++;         });     } }); return false; 

first set unique id each of "select" of index like:

'<select name="act" id="s'+ index +'">' 

and pass index "updatestatus(index)" function call.

function updatestatus(index) {     $('#s'+index).val(); // value of selected box. } 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -