Tuesday, 10 September 2013

Print dynamic Text box value using JQuery

Print dynamic Text box value using JQuery

I have a scenario like
for(int i = 0; i < 10; i++)
{
<input type = "text" id="test"+i value="" onchange="getValue(i)">
}
I want to print selected text box value using jquery. I tried below code,....
function getValue(id)
{
var value = $("#test"+id).val();
alert(value);
}
Some how the above code is not working. if i tried like var value =
document.getElementById("test"+id); then it is working.

No comments:

Post a Comment