selectors

looping through set of elements in jquery

Hi, $('form td .hint p') this jquery selector returns back a list [p,p,p,p,p,p]. I would like to know what's the best way to loop through each of those, check their css values, and do something if the css value = something I want. I have this function to show and hide a tooltip, but I only want one tooltip to be shown at a time. While ...

cancelling queued performSelector:afterDelay calls

hey there all, does anybody know if it is possible to cancel already queued selector events from the event stack or timer stack or whatever mechanism it is that is utilized by the API when you call performSelector:withObject:afterDelay? I was using this event stack to alter the attributes of an image within a TabBar tab, and would somet...

jQuery syntax question : ul as variable, remove item?

This is a simple syntax question. I have a ul saved as a variable like this: $list = $("#city_list"); I am later removing some items from the list with this code: $('ul#city_list li#city_' + $id).remove(); How can I do that using the $list variable I created earlier so that I get something like this: $list.('li#city_' + $id).remo...

NSCFSet objectAtIndex unrecognized selector, iterating works.

Hey guys, I was wondering how it can be that iterating through an NSMutableArray works, but when I call objectAtIndex it fails with "*** -[NSCFSet objectAtIndex:]: unrecognized selector sent to instance 0x..." Here is some sample code, the program is too big to share in whole so I hope it's enough. The code is executed in the latest iP...

Tips to reference DOM Elements working with jQuery

Need some Advice on how to reference elements with jQuery (DOM/Traversing/Selectors). Sometimes its just enough to set an id at the desired element and do this: $('#elementID').hide(); But sometimes it just cant be used, for example when working with list of n elements, i have seen some people attach a class to each element of the lis...

Prototype: how to dynamically construct selector?

I am having a little bit of difficulty passing a variable into a selector in prototype. I would like to be able to pass a variable into the select string, so that one function can work for many of the same kind. At the moment, this is what I would basically like to do: function myFunct(var) { $(var + 'add_form').hide() //so inde the...

CSS previous sibling selector

~ is for the next sibling. Is there an equivalent for the previous sibling? If there is not, a succinct no would suffice. :) ...

return type of input with jquery

I have a form with dynamically created form elements. I need to get the value of each element, and send an ajax request to make sure the data is ok (the easy part). I can get each elements value easy enough, but the problem comes in with radio buttons. For example: <input type = 'radio' class = 'form_element' value = '1'> <input type =...

Stacking CSS3 Structural pseudo-classes

While practicing different scenarios in which CSS3 pseudo-classes and selectors might come in handy, I ran across something I just can't figure out! Here's the situation. I want to modify the :first-of-type::first-letter of the first non-empty paragraph for a block of text. I'm not sure that pseudo-classes can be stacked though. Here's ...

jQuery - Append <th> Class to <td> in the Same Column

I've been searching all over the net for hours now but I still can't figure this out. <table> <tr> <th class="name">Name</th> <th class="age">Age</th> <th class="nick">Nick</th> </tr> <tr> <td>John</td> <td>30</td> <td>Johnny</td> </tr> <tr> <td>Robert</td> <td>35</td> <td>Bob</t...

How can I change the style of multiple elements using jQuery?

I have one CSS style sheet with rules like this: h1, h2, h3, h4, .contentheading, .title{ font-size: 13px ; font-weight: normal; font-family: Arial, Geneva, Helvetica, sans-serif ; } The tags, classes are generated by plugin so i can't add a single class to it. So, is there any way that I can change the styles of all elements at ...

jQuery. Apply selector to every field in a dynamic form

I have a form which is built dynamically using this jQuery plugin http://code.google.com/p/jquery-dynamic-form/ When I duplicate a div, all the fields in the div are duplicated, and -as plugin docs state- brackets are added to the field name I use also jQueryUI. I use the datePicker plugin $("#myDynDateField").datepicker(); It w...

Best way for fast processing

Hello all, As a PHP programmer faced a lot with (deepgoing) statements I'm curious how you handle this. Are you using switch, if-elseif-else or if-else structures? I personally prefer using the switch selector when dealing with more than 2 cases. Is this also the best way from a performance perspective? And how about nested statements?...

Jquery selectors behave oddly

In my html page, I wrote: $('div > input').click(function(){ alert(1); }); my div is like this: <div id="CPE202" class="course"> <input type="checkbox" name="core" value="core" /> Microprocessor programming <input type="radio" name="remove" value="remove" class="remove"/> </div...

How badly does jQuery performance degrade when using a lot of selectors, or does it?

I want to apply a click() event to all of the links on a page when the href of that link points to a file with a specific extension. The list of applicable extensions is hovering around 30 and may grow a bit in the future (but will never be more than 100). My first inclination is to structure the event binding like so: $("a[href$=avi],...

Selecting first row from multiple tables

Hey all, I've got a bit of a jQuery problem. I've got multiple tables on a page that all have the same class but no ID. I'd like to be able to be able to get the first row from all of the tables back. Is there an easy way to do this? This is what I've got so far: $(.t13Standard tr:first') But that only selects the first row from ...

Multiple Selectors with jQuery

Can I select two elements with Jquery at the one time? For example I tried this but it only selected the first element: $('.loginStaff' || '.loginClient').click(function(){ $('.login_form').toggle(); }); I also tried but this only selected the last element: $('.loginStaff' && '.loginClient').click(function(){ $('.login_form').togg...

Using Jquery to find the content of a TD

Hello I am trying to use Jquery to find TD's with X or Y content (text) inside. For example: http://sotkra.com/btol/index.php From left to right, the 7th COLUMN that reads 'TIPO MONEDA' displays either PESOS or DOLARES. I'd like to be able to do the following: 1.- Select TD's with the text 'DOLARES' or 'PESOS' and add a class to them...

How do the performance characteristics of jQuery selectors differ from those of CSS selectors?

I came across Google's Page Speed add-on for Firebug yesterday. The page about using efficient CSS selectors said to not use overqualified selectors, i.e. use #foo instead of div#foo. I thought the latter would be faster but Google's saying otherwise, and who am I to go against that? So that got me wondering if the same applied to jQuer...

jQuery: Using Variables in Selectors

Every searches I made only included solutions for variables like this: $('#div'+ id) I need to delete a row. var row = $(this).parent().parent().parent().find('tr#' + id).html(); I'd like to use the "row" name instead of "$(this)...remove();" ...