I am displaying a modal dialog using jQuery. This dialog has a textarea
control on it. But while submitting this dialog, the value of this textarea
Have you tried .attr("text")
or .attr("value")
? I'm unable to test this but this would seem logical to me.
If it doesn't then let me know and I'll remove this answer.
In opera for getting the value or a textarea works only:
document.getElementById("description").value;
strange is that $("textara#description").val("") works (set method)
Select <textarea>
by attribute name instead of id.
<textarea id="txtDescription" name="txtDescription"></textarea>
<script>
jQuery("textarea[name='txtDescription']").val();
</script>
you may have come across a very obscure bug referred to in a blog post on the Opera sitepatching blog 1 as "PATCH-287, Hack to make script see typed value in TEXTAREA on blog.ebuddy.com. Opera fails to read correct value from a previously hidden textarea".
I'm a little bit reluctant to recomment workarounds without seeing the full code though.
I use this workaround:
if (window.opera)
{
document.addEventListener('focus', function(event){
if (event.target instanceof HTMLTextAreaElement)
{
event.target.contentEditable = true;
event.target.contentEditable = false;
}
}, true);
}
Good day people,
I too have the same problem with Opera 10.63 and Windows.
The hack suggested by Javier Canizalez works, but only as long as I don't reuse the dialog (and the textarea) again. However, this is not the case. With his hack, after the page is loaded and I click on an item, I display a dialog that was previously hidden (display:none) with textarea inside it. Everything works fine the first time (with the hack). After closing the dialog /* $(dialog).hide()); */ and reusing it again by clicking on another item, the hack does not work anymore and javascript/jQuery does not get the new typed value anymore until a full page reload.
I found at one of the links given above that the guys at opera have fixed that problem: PATCH-287 But it does not seems fixed to me :) I wrote a question there and will see if they'll reply: opera patch-287
Has someone managed to get a workaround this?
Thank you and best regards.