I am trying to get the value of a textbox which is initially hidden through css and is displayed using simple jquery… Now i want to get the value of the textbox that is initially hidden… the code is as below :
$("#reply_send").click(function (e) {
e.preventDefault();
var name = $('#reply_name').val();
alert(name);
});
but this returns undefined. How do i get to get that value ?
You probably have an HTML error as this seems to be working fine. Assuming your textarea has an id of reply_name, then you will be able to retrieve the value with $(‘#reply_name’).val();.
check this out: Fiddle