JQuery val() does not work for textarea in Opera

Posted by Anil Soman on Stack Overflow See other posts from Stack Overflow or by Anil Soman
Published on 2010-09-16T05:36:07Z Indexed on 2010/12/30 6:54 UTC
Read the original article Hit count: 310

I am displaying a modal dialog using jQuery. This dialog has a textarea control on it. But on submitting this dialog, the value of this textarea is not recognized by jQyery 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?

Controls

<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();

$('#txtDescription').val() comes blank but $('#txtGroupName').val() 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.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about browser-compatibility