selectors

Get HTML element using jQuery

Hello, I have some DIVs with ID "div1", "div2" ... "divx". I want to perform an operation on them. Is there any way to get the element ID .contains "div". Any other idea? ...

UITableView Cell - get IndexPath.row from button?

I currently have a button defined in a cell and a method to track its UITouchDown action as shown: - (void) clickedCallSign:(id)sender { int index = [sender tag]; NSLog(@"event triggered %@",index); } - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath ...

Conditional if/then for gt: in jQuery

How do you say : if there are more than 2 .quick_fact then My attempt: if $(".quick_fact:gt(2)") { } Which evidently is always true. ...

jquery scrollTo nth child

Hi, If I had two sets of classes, like so <div class = "link 1"></div> <div class = "link 2"></div> <div class = "link 3"></div> .... <div class = "link x"></div> and <div class = "target 1"></div> <div class = "target 2"></div> <div class = "target 3"></div> .... <div class = "target x"></div> how can i get the nth link to scr...

Can jQuery create an element by a selector?

Normally I would create an element in jQuery like this $('<div id="errors" class="red"></div>') Can I create an element given a selector using something like $.create("div#errors.red")? Where that would return a jQuery object representing a div with the id of errors and the class of red? ...

Mootools wildcard selector

How can I select all elements whose IDs start with "row_", for example "row_223425" and "row_at264" etc.? What I am ultimately trying to do is give a background colour to each even .productWrapper div in this structure: <div id="container"> <div id="row_2531865"> <div class="productWrapper"> Product 1 content here....

Can I use this code to set the height of two elements in jQuery?

I want to set both #map_canvas and #content's height, but this doesn't seem to work: $(['#map_canvas','#content']).css("height", ($(window).height()-270 + "px")); Does anybody know how to do this? ...

JQuery selector help

Using JQuery, how do I select all elements with class x within an element with id y? ...

CSS child vs descendent selector

Somewhere I read that using the child selector (>) in css is faster than the descendant selector ( ). For example: 'p > em' as opposed to 'p em'. [I'll look for the reference]. It seems to me that the majority of code I see in the wild does not take advantage of this. I understand that certain circumstances would merit the use of one...

Sizzle selector syntax pattern of searchable items

Hey guys, I'm still learning how to use Sizzle selector. So far I know this: Sizzle('#blah') - searches the entire document for element(s) with id 'blah'. Sizzle('.blah') - searches the entire document for element(s) with css class 'blah'. Then today I found this: Sizzle('> div') - searches entire document for elements of 'div' tag...

JQuery: removing char from a String / selecting

I would like to select only one class from severals with the condition that the selected class has any div-descendant with the id "#exampleId". I thought something like this could work, but it didn't: $(".myClass").has(div).attr("id","#exampleId"). The second problem: I have to get rid first of the hash "#". because the String (#exa...

how to get next relative dropdown using jquery

i have this code <div id="aggregate" style="display:inline"> <%=Html.RadioButton("a", "1", true, new {id = "meRadio"})%><label>Me</label> <%=Html.RadioButton("a", "2", false, new { id = "teamRadio" })%><label>Team: </label><% = Html.DropDownList("Teams", Model.Teams, new {@scope="Team", @id = "t...

css selector to select first class element

Hello, I'm trying to select a first element of class 'A' in an element with id or class 'B'. I've tried a combination of > + and first-child selectors, since it's not a first element inside class element 'B'. It worked, but ... i'm trying to override some default css and i have no control over the server side and it seems that the class...

Matching an empty input box using CSS

How do I apply a style to an empty input box? If the user types something in the input field, the style should no longer be applied. Is this possible in CSS? I tried this: input[value=""] ...

jQuery - Select previous DOM element matching a class, when the DOM element is not in the same tree.

Hello, I'm trying to use jQuery to access a DOM object that appears earlier in the code from the DOM object that I am starting with. This would ordinarily be easy with jQuery's traversal methods, like .parentsUntil. However, in this case the object I am trying to find is not a parent or sibling of the object I am starting from. For exa...

Not able to open selector in solaris for non root user

I have a server application which runs fine in most of the cases but in one solaris machine it not able to open the selector ,for root user it is working fine. for other user it is giving the below exception java.io.IOException: Permission denied at sun.nio.ch.DevPollArrayWrapper.init(Native Method) at sun.nio.ch.DevPollArrayWrapper.<in...

jQuery selector: How to select by CSS styles

I'm trying to find all the parent elements that have the CSS style display:none. I can't seem to get it to work though. Here's what I've got: var $parents = $(...).parents("[css=display:none]"); ...

CSS / JQuery - Filtering Table Rows and Inverting the Selection

Hi, I have a table with a number of rows, I then want to highlight the rows that contain value x and then invert the selection. So far I am able to select the rows that contains the filter value but inverting it is giving me problems. First I am selecting the rows that match my search value and add a class name: var rows = $("#table ...

How can I get a selector from jQuery based on attribute

If I have this HTML: <a id="test" referenceId="test23" href=''>Test</a> and I want to get the selector based on the referenceId attribute (not the id) I know I can do this $('#test'). . .. but I want to understand if I can do a similar thing but using the referenceId attribute to get the selector. ...

jQuery selectors: multiselect vs select

Hello, Is it possible, via jQuery, to select a multiselect to a select, differently? The issue I'm having is that I have a general js called that does something to an id. However on some pages it has a different purpose. Therefore I would like about to recognize the difference. $("select#categories[multiselect]").doOneThing; //multis...