selectors

How to kill a selector that is set to fire after a delay (on the iPhone)?

If I have a view with a performSelector set to fire after a delay: [self performSelector:@selector(generateBall) withObject:NULL afterDelay:1.5]; ...but I removeFromSuperview that view before the selector fires (for example, due to user interaction), then my app crashes. Is there a way to kill the delayed selector in the dealloc met...

PHP DomDocument selectors like jQuery.. does exist something like that?

Hi guys, im pretty new to the PHP DomDocument, im reading the documentation right now and im wondering is does exixts some selectors like the ones we seen in jquery. Well, i exmplain my situation: i have this xml file to parse every day and update a database: Europe Bank Money Currency That's a little snapshot: <gesmes:Envelope> ...

jquery access to a user specific collection via table index?!

i have a table <table> <tr> <td class="myA">Data...1a</td> <td class="myA">Data...2a</td> <td class="myA">Data...3a</td> </tr> <tr> <td class="myB">Data...1b</td> <td class="myB">Data...2b</td> <td class="myB">Data...3b</td> </tr> <tr> <td class="myC">Data...1c</td> <td class="myC">Data...2c</td> <td class="my...

jquery selectors for plain javascript objects instead of DOM elements

I've just started using jquery and I'm really enjoying using selectors. It occurs to me that the idiom would be a very nice way to traverse object trees (e.g., JSON query results). For example, if I have an object like this: var obj = { 'foo': 1, 'bar': 2, 'child': { 'baz': [3, 4, 5] } }; I would love to be able ...

How to select an element that must have more than one css class?

I have an element that has two classes at all times: <p class="general_description laptop"> <p class="images laptop"> <p class="specs laptop"> One class describes the item (laptop) and the other (general_description, images, specs) describes the state that the page needs to be in to present one of three types of information about the ...

How do you retrieve the class to hide the button?

Given this HTML: <button id="buttonId1" class="hello universe"> <button id="buttonId2" class="hello world"> What's the correct way to do something like this: $("#buttonId1").click(function () { alert($("#buttonId1").getClass()); } I realize the getClass function does not exist in JQuery or Javascript. But I'm hoping there's ...

How to use a global selector to respond to all click events except on one element?

If I have a button: <button id="button1"> Normally I would write: $("#button1").click(function () { //do something } But I want to define a function that responds to all click events except when someone clicks on this button. Is there a selector that would allow me to target all other clickable elements in the document ex...

Can I put a single quote in a JQuery attribute equals selector ([attribute=value])?

My Html looks like this: <a href="#" id="QuoteTest">Click Here</a> <ul> <li title="this" style="position:relative">one</li> <li title="this" style="position:relative">two</li> <li title="tha't" style="position:relative" >three</li> <li title="tha't" style="position:relative...

jquery ajax problem

A few days ago I posted this question: http://stackoverflow.com/questions/1169387/switch-statement-and-loops-using-jquery-javascript which ended up with me creating a series of divs using this code for (var i = 1; i <= $("#play option:selected").text(); ++i) { $("#play_"+i).slideDown().find("input").addClass("someClass"); } ...

jQuery Selector Question

i am actually doing a accordion/sliding menu. here, i want to slide up sibling li > ul that has been open (or displayed). can i simplify this further? $(this).parent("li").siblings("li:has(ul)").children("ul").slideUp("fast"); i also noticed that i cannot skip the children() part and do something like $(this).parent("li").siblings(...

jQuery selectors performance

Hi I know I'm just being OCD about a few milliseconds worth of performance time, but I was just wondering why the following is true for me. It seems goes against my logic. I currently have a div that has fades out the image inside on hover: $('div.someclass').hover(function() { $(this).children('img').fadeOut(function(){ /...

jQuery selecting and filtering elements inside a div

Hi again all jQuery coder I have a problem with selecting and filtering elements inside a div. My html looks like this <div id="wrapper"> <input type="text" value="you can edit me"> <input type="button" value="click me"> </div> and my jQuery looks like this $("#wrapper").children().click(function() { alert("hi there"); ...

advanced jquery selection... first per attribute value

Okay, I'm not sure how to describe what i want to do concisely. So, take the following pseudo-html: <input type=checkbox id=chk1 myatr=1 /> <input type=checkbox id=chk2 myatr=1 /> <input type=checkbox id=chk3 myatr=2 /> <input type=checkbox id=chk4 myatr=1 /> <input type=checkbox id=chk5 myatr=2 /> <input type=checkbox id=chk6 myatr=3 ...

How do I prevent my style from being overridden another style on a surrounding div?

It seems elementary, but here is problem. Stylesheet like so: #Content h1, #Content h2, #Content h3, #Content h4, #Content h5, #Content h6 { color: #405679; } h3#issueHeader { color: blue; } HTML like so: <div id="Content"> <h3 id="issueHeader">In This Issue:</h3> </div> Instead of my issueHeader selector overriding the Co...

how to use if rule in jquery

Hi I have a simple modal popup which has 3 name fields and 3 e mail fields adjacent to each other. I am new to jQuery so can any one please help me how to write a logic for the following case? The first name field and Email field are mandatory so I kept the class as required fields but the other two name and e-mail fields are optional b...

What is the difference between jQuery's space and > selectors?

What's the difference between the space and > selectors? And possibly related, how can I look for something that's the direct child of something else, and not lower down the descendant line? ...

jQuery empty selector (null selector)

Sometimes it is useful to have an empty jQuery object, to be used either as a default value or as an initial value, when constructing a collection of items. For an example, see here. One way to do it would be to use a selector which is unlikely to match anything, like $('skdhjfksjdhfksjhdf'), but this is obviously inelegant. How can I...

jQuery Selector Comparison Articles

I'm reviewing a number of jQuery functions that have various implementations of id selection. I want to try and standardise on one best-practice approach, but before I do that I want to ensure that I pick the most efficient. Does anyone have links to good articles (such as this one) that make comparisons between different types of sele...

Are jQuery's :first and :eq(0) selectors functionally equivalent?

I'm not sure whether to use :first or :eq(0) in a selector. I'm pretty sure that they'll always return the same object, but is one speedier than the other? I'm sure someone here must have benchmarked these selectors before and I'm not really sure the best way to test if one is faster. Update: here's the bench I ran: /* start bench */...

selecting specfic options within a dropdown list with jquery

Hi - I'd like to be able to select a specific option within a dropdown list in order to manipulate it. For example, $("#mylist > option14").replaceWith(<option value="option155">New Option</option> How can I do this? Selecting through the child selector doens't seem to work. Thanks. ...