Anil Soman Anil Soman - 1 year ago 100
jQuery Question

JQuery val() does not work for textarea in Opera

I am displaying a modal dialog using jQuery. This dialog has a

control on it. But while submitting this dialog, the value of this
is not recognized by jQuery for some reason: it always comes blank.
This works perfectly in other browsers. I put alert to display the value but it looks blank. Can anybody help me in this regards?


<input type="text" id="txtGroupName"/>
<textarea rows="3" cols="30" id="txtDescription"></textarea>

jQuery code which used this value:

var postData = new Object();
postData.GroupName = $('#txtGroupName').val();
postData.Description = $('#txtDescription').val();

comes blank but
is read correctly as it is a input field.

One more finding about this issue:

When I put alert in my update function after populating the control value on page load, this alert displays the existing value properly. But it displays only existing value. It does not display the edited value after submitting the modal box.

Answer Source

I fix this using this in textarea


put at end of script. I am sorry for my english

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download