Click here to Skip to main content
15,912,977 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello friends!
in mvc 2,here is a intput control with type="text"
and i want to get its text via client side to make an ajax call, the issue is that the text achieved is always null,shortly want to get the text via javascript or jquery ,help me..........
Posted
Comments
ArunRajendra 10-Jul-13 0:25am    
Put the jquery code through which you are trying to fetch the value from text control.
Zubair SE 10-Jul-13 2:57am    
no it is giving undefined
Zubair SE 7-Oct-13 1:37am    
use this,
var getText=$('#controlID').Val(); or
var getText=$('#controlID').Text();
should work otherwise properly check the id is correct,

1 solution

For Get the Value
JavaScript
<script type="text/javascript>">
$(document).ready(function()
{
var getText=$("#txtId").val();
});
</script>


Please make sure that you must include jQuery plugin. You can download it from here
http://jquery.com/download/[^]
Hope this helps
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900