I have the following form. What I am trying to do is when the value of rate[] is changed I want to get the value of the changed value and the value of product[] using jquery.
For example: if I change the value of rate[] (from the first row of the table) to 100, I want to get the new value of rate[] ..100 and its product_id[].. 1001
<form id="myform">
<table>
<tr>
<td>Product 1</td>
<input type="hidden" name="product_id[]" value="1001" />
<td><input type="text" name="rate[]" value="2" /></td>
<td><input type="text" name="quantity[]" value="10" /></td>
</tr>
<tr>
<td>Product 2</td>
<input type="hidden" name="product_id[]" value="1002" />
<td><input type="text" name="rate[]" value="2" /></td>
<td><input type="text" name="quantity[]" value="10" /></td>
</tr>
<table>
</form>
My JQuery code;
<script type="text/javascript">
$(":text[name='rate[]']").bind("keyup", function() {
// What to write here?
});
Could you please help me to write the jquery code to find out those values?
Thanks 🙂
This should work: