FireFox文本区域问题在模态对话框 [英] FireFox textarea issue in modal dialog

查看:234
本文介绍了FireFox文本区域问题在模态对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jQuery UI模态对话框中有一个textarea。
我尝试更改这样的文本框值:

  1)$('#textarea')。val测试值'); 
2)$('#textarea')。text('test value');

这两个都可以在所有浏览器中运行。除了在Firefox中它只能工作在ONCE。



当再次使用新值调用其中一个时,textarea值保持不变。无论是在模式对话框打开时还是在打开之前(它打开textarea id =textarea作为内容的一部分) - 所以在打开之前更改它的值,应该在打开时保留该值文本框)。



如另一个线程中所建议的,我尝试过

  $('#textarea')。css('display','block'); 

在设置textarea的值之前和之后。



任何线索?



我不知道为什么这个问题只发生在FireFox中 - 通常是Firefox中的所有功能,但不在其他浏览器中。 p>

谢谢。

解决方案

我遇到Firefox 5.0的这个问题。 1和jQuery UI 1.8.14



我以某种方式通过在点击事件处理程序内移动.dialog()调用而不是创建对话框onload。这意味着每次点击打开对话框就可以重新创建整个对话框(我认为),这可能是修复textarea问题的一个问题。



你的里程可能会有所不同。 p>

I've got a textarea inside a jQuery UI modal dialog. I tried changing the textbox value like this:

1) $('#textarea').val('test value');
2) $('#textarea').text('test value');

Both of these work in all browsers. Except in Firefox it only works ONCE.

When calling to either of these once again with a new value, the textarea value remains unchanged. No matter if this is while the modal dialog is open or prior to opening it (it opens with the textarea id="textarea" as part of the content - so changing the value of it prior to opening, SHOULD leave the value when opening the textbox).

As suggested in an other thread, I tried doing

$('#textarea').css('display', 'block');

both prior and after setting the value of the textarea.

Any clues?

I can't figure out why this issue occurs just in FireFox - usually everythings functions in Firefox but not in other browsers.

Thank you.

解决方案

I ran into this issue with Firefox 5.0.1 and jQuery UI 1.8.14

I've somehow hacked around this by moving the .dialog() call inside a click event handler instead of creating the dialog onload. This means that each click to open the dialog recreates the whole dialog (I think), and that may be what's fixing the textarea issue.

Your mileage may vary.

这篇关于FireFox文本区域问题在模态对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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