开发者

jQuery find / is(':visible') problem

Please see the code here:

http://jsfiddle.net/wQpTu/1/

For some reason, it always returns f开发者_运维百科alse on the .is(':visible') whether or not it is visible.

Any reason why? Anything I should be doing differently?


You need to use:

var visibleElement = $('#holder').find("span#spanselect").is(":visible");

spanselect is an id, not a class.

$("#holder span#spanselect") would work just the same, by the way. For the record, you can changed is(":visible") to length ans saw it was equal to 0, and easily see the selector fails.

Example: http://jsfiddle.net/kobi/wQpTu/5/


You are using "." instead of "#". This will work:

var visibleElement = $('#holder').find("span.spanselect").is(":visible");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜