sizzle

How to select table cells without selecting nested table cells in jQuery

孤人 提交于 2019-12-06 09:26:56
I want to select only the first level of 'td' elements in a table and not the cells of any nested tables. eg: <table id="Outer"> <tr> <td> --this one </td> <td> --this one <table> <tr> <td></td> -- but not this one or any deeper nested cells </tr> </table> </td> </tr> </table> (and yes in prod code i would include tbody, thead...) I'd use the children selector, which only selects the immediate children matching the expression. To make it easy to select just the outer table, I'd give it a name. NOTE: this won't work with your sample as I've added in the selectors for thead, tbody, and tfoot as

jQuery selector bug? composed selector vs. simple selector & find()

ぃ、小莉子 提交于 2019-12-06 04:21:46
Something is very awkward about my situation... i have something like this: <div id="selector"> <input type='radio' /> <input type='radio' /> <input type='radio' /> </div> if I use $("#selector input[type=radio]") all three elements are found, but if I use $("#selector").find("input[type=radio]") or even find("input") only the first one is found. Is this a bug in jQuery? Am I not using find() properly? Clarification : I want to use find() to get all the inputs, but anything I try finds only the first one. edit: i'm using jquery 1.3.2 What you really want is: $("#selector > :radio") As for why

jQuery 1.4.4: How to find an element based on its data-attribute value?

情到浓时终转凉″ 提交于 2019-12-06 00:59:28
问题 I imagine this should be a pretty trivial task but using Firefox for Mac, 3.6.12 the following does not work: // assign data attributes $('.gallery li').each(function(i) { $(this).data('slide',i+1); }); // outputting an empty jQuery object console.log($('.gallery li[data-slide]')); // this does not work either outputting an empty jQuery object console.log($("[data-slide]")); using Firebug I can see that all the data-slide attributes including their numerical value are correctly attached to

Using jQuery to select elements with data attributes assigns a null ID to its parent elements

假如想象 提交于 2019-12-05 21:35:45
This is truly bizarre. If I use jQuery's .find() to find child elements that have data attributes during a scroll event, then scrolling the page will repeatedly add and remove an ID to the parents of those elements. It's difficult to describe, but here's a reproducible test case: http://jsfiddle.net/8fouvx9p/ var groups = $(".group"); $(window).bind("scroll resize orientationchange", function() { showGroup(); }); function showGroup() { $(groups).each(function() { var group = $(this), elements = $(group).find("[data-animation]"); }); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1

Get iframe contents with a jquery selector

夙愿已清 提交于 2019-12-05 02:23:26
Is there anyway to access an iframe's contents via a selector? Something like this: $("iframe::contents .my-foo") I'm constantly accessing an iframe's contents for a project I'm currently working on and $("iframe").contents().find(".my-foo") is becoming a bit tedious to type out. If this feature doesn't exist in jquery out of the box, is there a plugin that provides this functionality? If not how could I write such a plugin? I had this issue once where I found it tedious. I never found a solution for how to write a single selector like that. Even so, the selector is still rather long. The most

Is there a JQuery DOM manipulator/CSS selector equivalent class in PHP?

陌路散爱 提交于 2019-12-04 17:13:57
I know that I can use DOMDocument and DOMXPath to manipulate XML files. But, I really love JQuery, and it would be great if there was something more like JQuery in the PHP world that I could use for sever side DOM manipulation. NOTE: I'm only interested here in how JQuery Selects and Manipulates the DOM, not all the other parts of JQuery (I guess you can say just the Pop and the Sizzle parts). Update: It looks like there is an equivalent for the selector functions, but as far as the manipulation functions I guess I have to stick with DOMDocument. Well, excluding all the JavaScript specific

jQuery 1.4.4: How to find an element based on its data-attribute value?

不羁岁月 提交于 2019-12-04 06:51:40
I imagine this should be a pretty trivial task but using Firefox for Mac, 3.6.12 the following does not work: // assign data attributes $('.gallery li').each(function(i) { $(this).data('slide',i+1); }); // outputting an empty jQuery object console.log($('.gallery li[data-slide]')); // this does not work either outputting an empty jQuery object console.log($("[data-slide]")); using Firebug I can see that all the data-slide attributes including their numerical value are correctly attached to the li s and logging out: $('.gallery li').each(function(index) { console.log($(this).data()); });

jQuery .prev() of a type regardless of it's parent etc

别来无恙 提交于 2019-12-04 06:11:34
问题 is there a simple way to get the previous occurrence of an element in the DOM? If I'm looking at #text3 and I want to get ahold of the previous input #text2 . <div> <input id="text1" type="text" value="text1" /> </div> <div> <p>Choose your race!</p> <input id="text2" type="text" value="text2" /> </div> <div> <div class="labeledField"> <label>Text 3:</label> <input id="text3" type="text" value="text3" /> </div> </div> .prev('input') doesn't work cause it's within the parent and .prevAll('input

decoupling jquery, sizzle?

[亡魂溺海] 提交于 2019-12-03 08:40:08
问题 Does anyone have experience / insight re: decoupling jquery / sizzle? this is for general interest, but here's the scenario that triggered my question: ..i already have jquery in the project. wanted to try out http://ecsstender.org/, which requires the Sizzle selector engine. I dont really want to include a 2nd copy of Sizzle - its already part of jquery .. would rather do something like this: http://forum.jquery.com/topic/further-decoupling-sizzle-and-jquery e.g. create a jquery build that

decoupling jquery, sizzle?

无人久伴 提交于 2019-12-02 22:32:24
Does anyone have experience / insight re: decoupling jquery / sizzle? this is for general interest, but here's the scenario that triggered my question: ..i already have jquery in the project. wanted to try out http://ecsstender.org/ , which requires the Sizzle selector engine. I dont really want to include a 2nd copy of Sizzle - its already part of jquery .. would rather do something like this: http://forum.jquery.com/topic/further-decoupling-sizzle-and-jquery e.g. create a jquery build that depends on an external, rather than embedded, version of Sizzle - so the same Sizzle lib can be used by