I have a question getting the values from a textbox using jquery. My code is as follows:
<table width="500" border="0">
<tr>
<td><input type="text" class="quantity" /></td>
<td><input type="button" class="btn" p_id="item2" value="submit" /></td>
</tr>
<tr>
<td><input type="text" class="quantity" /></td>
<td><input type="button" class="btn" p_id="item3" value="submit" /></td>
</tr>
<tr>
<td><input type="text" class="quantity" /></td>
<td><input type="button" class="btn" p_id="item4" value="submit" /></td>
</tr>
</table>
<script>
$(document).ready(function(){
$('.btn').click(function(){
var p_id = $(this).attr("p_id");
var q_ty = $('#quantity').val();
$.post("updateQty.php",{p_id:p_id, q_ty:q_ty},function(result){
alert(result);
});
});
});
</script>
I have managed to get the ID for the items, but I can't get the values for the textbox that is selected.