如何在文本字段中获得价值

i have one text field and setting its name & values from php, like:

<input type="text" id="qtyProductID_' . $productID . '" 
  size="3" value="' . $totalItems . '" >

i also have image button for click event

<a href=fun.php?action=update&productID=' . $productID . ' 
  onClick="return false;"><img 
  src="images/update.jpg" id="updateProductID_' . $productID . '"></a>

now after click in JS file i want to get value of text field i click

var productIDValSplitter = (this.id).split("_");
var productIDVal = productIDValSplitter[1]; 
var tqty = $('#qtyProductID_'.productIDVal[1]).attr('value');   
alert(tqty); 

i am getting error

i am looking for how to set the variable name in

$('#qtyProductID_'.productIDVal[1])

Thanks

.val() is what you're looking for

$("#someInput").val() 

What's the error?

In javascript the plus (+) sign is used for string concatenation, so

$('#qtyProductID_'+productIDVal[1]).attr('value'); 

but just like brad said, it can be written as

$('#qtyProductID_'+productIDVal[1]).val(); 

because jQuery offers a unified method of getting values from form input fields, not just <input>, but <select> and <textarea> as well.