【发布时间】:2012-01-10 08:27:36
【问题描述】:
if ($("#makespan").is(":visible") == true) {
var make = $("#make").val();
}
else {
var make = $("#othermake").val();
}
Make:<span id=makespan><select id=make></select><span id=othermakebutton class=txtbutton>Other?</span></span><span id=othermakespan style="display: none;"><input type=text name=othermake id=othermake> - <span id=othermakecancel class=txtbutton>Cancel</span></span>
以上代码在 Firefox 中运行流畅,但在 Chrome 中似乎无法运行。在 Chrome 中,它显示 .is(":visible") = false,即使它是 true。
我正在使用以下 jQuery 版本:jquery-1.4.3.min.js
jsFiddle 链接:http://jsfiddle.net/WJU2r/4/
【问题讨论】:
-
最好在 jsfiddle 链接中?并可能使用 jquery.latest 进行检查。
-
makaspan 可能是 display: none 或 visibility: hidden?
-
并且可能会暂时更新到最新的 jQuery 版本,只是为了排除 jQuery 错误?
-
另见:bugs.jquery.com/ticket/13132 似乎它将在版本 1.12/2.2 中修复! ——
-
不需要在 if 语句中添加“ == true ” : if ($("#makespan").is(":visible") ) 足够
标签: jquery google-chrome