I have a function CheckMobile(MobNumber) and it will check all duplicate record of MobNumber which is passed in function. I want to use jquery to implement this.
<td><input type='text' name='Phone2' class='required' maxlength='10' /></td>
<td><a href="javascript:void(0)" onclick="CheckMobile(Phone2)">Check Phone</a></td>
and my jquery function is:
function CheckMobile(MobNumber) {
debugger;
var phone = $(MobNumber).val();
alert(phone);
}
But it does not work. In function i am getting undefined value.Please help how to get value of phone.
You can get at the input by doing:
In jQuery and then use
.val()to get the value. (Working JSFiddle: http://jsfiddle.net/PhT94/)EDIT:
Didn’t notice you’d given it an ID, in that case you could just do:
So in your original code change:
To