JQuery val()在Opera中的textarea不工作 [英] JQuery val() does not work for textarea in Opera

查看:194
本文介绍了JQuery val()在Opera中的textarea不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery显示模态对话框。此对话框上有一个 textarea 控件。但是在提交此对话框时,由于某些原因,jQuery无法识别此 textarea 的值:它始终为空。
这在其他浏览器中完美工作。我把警报显示的价值,但它看起来空白。在这方面,有人能帮助我吗?

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 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代码:

jQuery code which used this value:

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

$('#txtDescription')。 $ c>空白,但 $('#txtGroupName')。val()正确读取,因为它是一个输入字段。

$('#txtDescription').val() comes blank but $('#txtGroupName').val() is read correctly as it is a input field.

有关此问题的另一个发现:

One more finding about this issue:

当我在页面加载填充控件值后在我的更新函数中添加alert时,此警报会显示现有值正确。但它只显示现有值。

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.

推荐答案

我在textarea中修复此问题

I fix this using this in textarea

$("#descripcion").keydown(function(){
     $("#descripcion").css("display","block");
});

放在脚本的结尾。
对不起,我的英语

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

这篇关于JQuery val()在Opera中的textarea不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆