selectors

Remove a class select option is not selected

Hello, When i select something from a selectbox it adds a class to the selected option this way: $('div#tabs input[type="text"], select option:selected, input:checked, textarea').addClass('takethis'); But when i select a different option it doesn't remove the class 'takethis' from the option which I first selected. How...

Remove a class select option is not selected

Exact Duplicate: Remove a class select option is not selected Hello, When i select something from a selectbox it adds a class to the selected option this way: $('div#tabs input[type="text"], select option:selected, input:checked, textarea').addClass('takethis'); But when i select a different option it doesn't remov...

remove class from radiobutton

Houw would i do the same thing like this for radio buttons in jquery? $("select option:not(:selected)").removeClass("takethis"); ...

In JQuery, how can I select a hidden element?

Hi,I have a question. How can I select the which display is none? Given code like this: <p id="p1"> <span id="test1" style="display:none">test1</span> <span id="test2" >test2</span> </p> I can select the whose id is test1 by using $("span[id='test1']"),<br/>, but it does not work when i use $("span[style='display:none']").<br/>. ...

Hiding then showing a div using jQuery

I want to slideUp some divs, then slideDown 1 div. However, I'm having some issues. $("#divDocument,#divLocation").slideUp("normal", function() { $("#divSearch").slideDown("normal", doStuff()); }); With this code, divDocument is visible, divLocation isn't. Because the divLocation is already hidden the doStuff() event fires immedia...

Problem selecting class using jquery

Hi everyone, I've been banging my head against a wall trying make this work for a while now. I'm trying to shorten the comment body to one line for compact comment preview. I'm using jquery .each function to go through each .cbody (comment body) in my threaded comment system and place it in the cshort div inside chead. It should work but...

see if parent is checkbox

How can I check if "this" is a checkbox? This is the way to see if it is an selectbox if($(this).parent().is('select')) { Now can I see wether it is a checkbox? So I tried this: }else if($(this).is(:Checkbox)){\n But it gives me a syntax error. Any help is welcome. ...

Chaining selectors in jQuery

I'm a guy used to mootools' way of chaining selectors, and I can't seem to find anywhere how to do the same in jQuery. Suppose I have a select element in the selectObj variable. What I need is to get the last option in that select. In mootools I would have done something like: var option = $(selectObj).getElement('nth-child(last)') Ca...

Reference either of 2 images nested inside a <div> using jQuery

Hi, My DOM looks like: <div id="blah-1"> <div class="class1"> <div class="class11> <a href=""><img src=""></a> <b>blah</b> <a href=""><img src=""></a> </div> </div> </div> I have to change the source of the 1st or sometimes 2nd img. I am using jQuery and don't have a strong handle with selectors just ye...

CSS selector for targeting only immediate children and not other identical descendants

I have nested sortable list that can have items dynamically added or removed and can be nested n-levels deep. On nesting, a new ul element is injected into whatever li element is selected to be the parent. The initial state of the list is something like the following: <ul id="parent"> <li id="One"><a href="" class="listLink"><span c...

jQuery Selectors

I'm finding it difficult to find examples of using jQuery, so my bad for asking such a simple question. I've got this ul: <ul id="navLinks"> <li class="selected" id="homeNavLink"></li> <li id="aboutNavLink"></li> <li id="contactNavLink"></li> ... </ul> I'd like to write a function to change which li has the "selected"...

jQuery fade all other images

Hi, I made this code with jQuery to fade images (but not the one a move the mouse over) and all images fade at the same time! $(".playThumb").fadeTo("normal", 1); $(".playThumb").hover(function() { $(".playThumb").each(function() { if ( $(this) != $(this) ) { $(this).fadeTo("fast", 0.3); } }); }, function() { $(".playThumb")....

Firefox's CSS3 "nth-child" support?

According to css3.info's selector test, Firefox 3.0 supports some permutations of the nth-child selector. However, the code shown here (#30) doesn't work for me. It should select the empty paragraphs, so I edited my code to the following but it doesn't show in Firefox (it works in Opera). <style type="text/css"> div :nth-child(even) { ...

SIFR'ing <LI> parents only

I'm using SIFR 3.0 in combination with suckerfish popup menus. I only want to SIFR the top level li's and not apply the effect to the nested ones. I'm also using WordPress, so restructuring the menu, like wrapping the parent in a <div> or other object is too hard (I'm still figuring out the basics of WordPress). Is there a way to turn S...

Selectors in Objective C

First, I'm not sure I really understand what a selector is. From my understanding, it's a name of a method, and you can assign it to a class of type 'SEL' and then run methods such as respondToSelector to see if the receiver implements that method. Can someone offer up a better explanation? Secondly, to this point, I have the follow...

attributes not selectable by jquery attribute selector

I am auto generating selectors and ive ran into a problem. some attribute selectors dont work. for example, on this page the following selector does not work as expected: $("img[src=/p/aost/logo?logo_id=1238551994]"); I also noticed that I cant select a <form> using the value of the action attribute. Question: Is there a full list s...

attributes not found by jquery attribute selector

I need to reask my old question, I probably shouldnt have asked it at 1am :P It seems that some attributes are not being found using jquery's attribute selector: $("*[some=value]"); So far it seems that i cant use form's action attribute, and img's src attribute. Is there a list somewhere of attributes that do not work so i can write...

Problem using jQuery > selector

I have something like the following jQuery code buttons = document.createElement('div'); $(buttons).addClass("overlay_buttons").css({ styles }); save = document.createElement('input'); $(save).attr({ type: "button", value: "Save" }).css({width:'45%'}); undo = document.createElement('input'); $(undo).attr({ type...

jQuery Selectors and Filtering

Hi all: I'm just getting going with jQuery and am pretty excited about it. My reason for posting is that I've written some jQuery that does it's required task, but I'm suspecting that it lacks a little in elegance... I'm trying to grab all table rows that have: 1) a class of 'item' 2) a child text input box that has a value The HTML...

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

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 <...