开发者

Jquery selector syntax

开发者 https://www.devze.com 2023-02-04 14:23 出处:网络
I\'ve come across开发者_JAVA百科 this syntax in some code, it\'s breaking in IE8 but works in others, any clue what it\'s doing.

I've come across开发者_JAVA百科 this syntax in some code, it's breaking in IE8 but works in others, any clue what it's doing.

$(this.handle()).find("[id]:visible:enabled");

I thought it might be looking searching all elements in the current page for ids and then searching the resultant elements for attributes "visible" and "enabled" but I don't think so now. The developer tool in IE8 does not show any results when I search for "visible" or "enabled"!

returns Failed in IE8.


This selector should find all child elements with an id attribute that are visible and enabled. From this test it appears to be working. Tested in IE8 and Chrome.


It depends on the context in which it is run. what is "this" and does it have a function called "handle" ? if not, then thats a reason for it to fail.

For this to work this.handle() would have to return something for jQuery to traverse, in which case it return all the elements Josiah Rudell already pointed out


http://api.jquery.com/visible-selector/ http://api.jquery.com/enabled-selector/


this.handle() does return something valid and $(this.handle()) is a jquery object. Find is available. The query works correctly on Chrome but not on IE8. I see the docs on these selectors now api.jquery.com/enabled-selector and api.jquery.com/visible-selector, this answers my question really . It looks like the JQuery find method is working differently on the browsers. this issue should probably be referred to jquery itself.

0

精彩评论

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