Jquery, Get Value of item with a function

I have an update function and many input fields with a Quantity, I use the update function “onkeyup” for each input field/box. I want to get the value of the field that has been changed. How could I get the value of the field that was changed, key was up on.
Heres my code

Input boxes


<input type="text" class="shopcart_qty" size="2" onkeyup="update('1');" name="cart_1" value="1" >
<input type="text" class="shopcart_qty" size="2" onkeyup="update('2');" name="cart_2" value="5" >

Update Function


        function update(){
				
					//var qty = $(this).val();
					// This above^^ doesn't work
                                              alert(qty);
				
				
				
				
				}

please assign each input box a unique id and pass that id in update() function as i did below.

[php]
//here i have added id to input box

//modify update function

function update(x){
var qty = $(’#’+x).val();
alert(qty);
}
[/php]

it will work perfectly for you,
reply with your feedback
SR

Sponsor our Newsletter | Privacy Policy | Terms of Service