selectors

jQuery selection: traversing up, then back down

I am struggling with how to select a particular element with jQuery. Conditions outlined here: At the relevant point in my function, this references a span. That span may be a child, grand child, or great grand child, but somewhere up the hierarchy, it's contained by a td. I'd like to select the last span inside of the td. The span may...

Is there a way to query HTML/XML content from a variable using jQuery?

If I have HTML content in a variable like so: var data = "<div id='myid'><div id='subid'>Text</div></div>"; Is there a way to query this using jQuery and selectors? As this, if it were HTML DOM: var data = $("#myid > #subid").text(); ...

Is there an wrapper object for SEL?

I want to add selectors to an NSMutableArray. But since they're opaque types and no objects, that wouldn't work, right? Is there an wrapper object I can use? Or do I have to create my own? ...

jquery IE8 selector bizarreness

I'm working with an xml node of the following structure: <CF> <T> <TX>title</TX> <em>15:2:</em> </T> <KW> <TX>SOMETHING ELSE</TX> </KW> <!-- OTHER TAGS, SOME OF WHICH HAVE A <TX> CHILD --> </CF> Things work more or less as I expect in firefox, but I'm getting weird behavior in IE8. For example, the following gives me a jque...

jquery selectors -- finding a child of the root node

It seems that this should be simple, but I'm having trouble figuring out how to construct a selector that will return only elements that are a direct child of a root node. If, for example, I have a reference to a div (myDiv), and I want to select only images that are direct children of that div, the following doesn't work: jQuery("div ...

How to addClass to the first td in every tr inside a table using jQuery

I'm trying to add a class to the first td inside a tr w/ a specific class. But for some reason it adds this class only to the first td in the first tr -not the first td in each tr $("#appendTD").find("#gridFormInformation").children(0).children().each( function() { if ($("#appendTD").find('tr').filte...

jQuery selector problem

Here is my html source code: <ul id="accordion"> <li><h3><a id="1"></a></h3></li> <li><h3><a id="2"></a></h3></li> <li><h3><a id="3"></a></h3></li> </ul> and javascript <script type="text/javascript"> $(document).ready(function(){ $('#accordion li h3').click(function(){ //I want to alert the id attribute of a, but i don't kn...

What JQuery selector excludes items with a parent that matches a given selector?

I have var $set = $('.foo,.bar').filter( function() {return $(this).parents('.baz').length < 1;}); as a way to select all the elements whose classes are either foo or bar and who do not descend from an element whose class is baz. Is there a selector that will accomplish the same thing without the need for a filtering lambda? <di...

IE7 input:focus

I have the following CSS which isn't working in IE7. input:focus{border-width: 2px;border-color: Blue; border-style: solid;} Basically, I just want to set the border attributes when the input is focused. Works in Firefox etc... If anyone could explain why it isn't working in IE 7 and suggest a possible workaround it would be appreci...

jQuery: how can I control a div's opacity when hovering over another div?

Hello everyone. I am currently working on my portfolio website which uses a very simple navigation. However what I want to do is have the drop shadow beneath the type become stronger (read: higher opacity/ darker) when the type is being hovered on. Right now my code looks as follows and does not generate any errors but simply does not ...

How to replace all content of <body> but a <div> with jquery ?

I got a markup with the following structure : <body> <h1>Title</h1> <p>bla</p> <div> ... <!-- a thousand tags --> </div> <div id="do-not-modify-me"> <!-- a hundred tags --> </div> </body> I wish to do a little search an replace in the body, but this must not change #do-not-modify-me because it has JS events attach...

Selecting only first-level elements in jquery

How can I select the link elements of only the parent <ul> from a list like this? <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a> <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </li> <li>...

XML parsing in Jquery

I have an XML file which has four <resutGroups> tag: <resultGroups> <subGroups> <name> </name> </subGroups> <name> </name> </resultGroups> each <resultGroup> has several <subGroups> and each <subGroups> has <name> tag. I want to select only the name tag of <resultGroups> only $(xml).find("resultGroups").each(function() { ...

CSS ID and Class Selectors

What do these two CSS selectors mean? h1#myItemOne h2 { background:#0099FF; color: #A3F4A3; } h1.myItemTwo h2 { background:#0099FF; color: #A3F4A3; } Are these two selectors valid for use? ...

Can 2 CSS classes activate the same script?

Hi, the script below makes the page fade out upon clicks on links that have class="nav". I would like to have the script ALSO activated in the same way for links that have class="home". How would would do this? Is there such a thing as $('.nav & .home')?? Thanks <script type="text/javascript"> $('.nav').click(function(){ var url = ...

Jquery selector

<a class='leftpanel_anchor' tag='solutions' href='javascript:void(0)' > Solutions to <span class='leftpanel_keywords'>firstConResult</span></a> i have an anchor like this. i want to select the content inside span class 'leftpanel_keywords'. how can i do that with jquery??? ...

jquery selector can't read from hidden field

(answers aggregated into another question) The following jquery 1.3.2 code works: <input type="select" value="236434" id="ixd" name='ixd' /> <script> console.log( $('#ixd') ); console.log( $("input[name='ixd']") ); </script> Console shows: [input#ixd 236434] [input#ixd 236434] However setting the input to "hidden" preven...

How to update style after ajax call in jQuery?

I have dynamicaly added input fields like this one: <input id="person__1_badge_number" class="number" type="text" size="12" name="person[][1][badge][number]"/> And when I add this field I call fallowing function: function please_rebind() { $('.number').bind("change", function() { $.post('/registration/sell/check_badge_number', ...

jquery hidden field not accessible until $(document).ready() called

(aggregated from another question) Jquery 1.3.2 test code, run in FF3: <input type="hidden" value="236434" id="ixd" name='ixd' /> <script> console.log( $('#ixd').val() ); console.log( $('#ixd') ); console.log( $("input[name='ixd']") ); console.log( $("input:hidden") ); console.log( $("input[name='ixd'][type='hidden']") ); console.lo...

How can I exclude these elements from a jQuery selection?

My jQuery: $("ul.dropdown ul").slideDown("slow"); $("ul.dropdown ul ul").children().hide(); That causes the ones that match the second selector to display for a brief time. How can I exclude the second set from the first set, and only show the first set? My HTML: <ul class="dropdown"> <li style="margin: 0px"> <span ...