jquery-selectors

How can I make jQuery select an element in the style of CSS?

<div id="id" class="div-style"><img id="id" class="img-style"></div> I would like to use the id attribute as a way for jQuery to select the element, and the class attribute for CSS to style it. My guess for jQuery selector ran thusly: $("#id .div-class") and $("#id .img-class") This returns the error "Selector expected" ...

jquery javascript error using $(...) selector

Hi, I'm migrating some old code to jquery: xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { $("#" + ajaxArea).html (xmlHttp.responseText); $("#" + ajaxArea).attr('title', 'Login'); $("#" + ajaxArea).dialog({ height : 140, modal : true }); } }; where ajaxArea is the ID of a DIV in the...

jQuery li:has(ul) selector issue

I was creating a tree using UL LI list and jQuery. I used a jQuery Selector jQuery(li:has(ul)) to find all the list nodes having childs and then added a click event to it. jQuery(li:has(ul)).click(function(event) { jQuery(this).children.toggle(); jQuery(this).css("cursor","hand"); }); This works for me except i dont unders...

jQuery animate() - multiple selectors and variables, a unique animate() call

Hi guys, I am resizing several divs in a loop with animate() in jQuery. At the same time I am moving (left property, no resizing at all) the div where they are contained. Problem is, despite they have same duration the resize animate calls finish before the move call. They are out of sync. Is there any way of creating a list of selecto...

difference between :first and :first-child not clear

i am having a ul li list <ul> <li>Parent <ul> <li> child1 </li> <li> child2 </li> </ul> </li> </ul> and i am trying to use a selector jQuery('ul li:first') and jQuery('ul li:first-child') both giving the same result this makes me confused about the difference between the two i...

How do I select only the 4th and higher LIs in each UL?

For this XHTML: <ul class="collapse"> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> </ul> <ul class="collapse"> <li>1</li> <li>2</li> <li>3</li> <li>4</li> </ul> Using jQuery, how do I select only the 4th and higher LIs in each UL? I've tried: $("ul.collapse li:gt(2)").css("color", "red"); But it selects ...

jQuery indexOf select box manipulation

Hi, I'm trying to figure out how to remove options from a select box when that option has been selected in an adjacent select box. Basically the user has the option to add multiple records here via select boxes, but I want to remove the list of options available to them so that, for example, they can't enter the same value in two select ...

jQuery select an element by multiple css classes

jQuery Class selector works well if you have a single class assigned to an element. What if I assign two classes to an element(Ex: <div class="one two">), how can I find that element if I know these two classes? ...

jQuery Selector Problem (First TD in each TR in a table)

Hello, I'm trying to add a css class to the first td (cell) (and no other td) of each tr (row) in my table. Can someone help me with the jQuery selector for this please? Thank you! ...

Use jquery to get text from columns of a table where a column contains text?

I am attempting to return columns of text where a column contains certain text. For example: the text i'm looking for is "02/06/2010". <table> <tr> <td>Item Title1</td> <td>Item Category</td> <td>02/06/2010</td> </tr> <tr> <td>Item Title2</td> <td>Item Category</td> <td>02...

div in an iframe

In an iframe how to make a div to hide and on mouse over the bottom of the page bring it to front again. This is just like a control that appears in medial players,hide when mouse out and show when mouse over <div> <img src="play.gif"/> <img src="next.gif"/> <img src="last.gif"/> <img src="first.gif"/> ...

Jquery Selectors not working

I use the following selector to get the value out of an input that's inside a table but it doesnt work properly? var kom =$("tr#1 .b input").attr(value); and row looks as follow <tr class="numbers" id="1"> <td class="a" align="right">1</td> <td class="a" align="left">Tue</td> <td class="b"><input class="input" type="text" ...

Using jQuery how can you select all DOM elements that have a pixel value set in the source HTML?

Hi, I'm writing some tests and one of the assertions has to ensure an HTML document only uses px units of measurement where specified. I'm using jQuery but I can't work out the way to select those elements. These elements will be the ones with things like margin and padding specifically set and not just the inherited values or pixel val...

Add change() function to all but last element of a class.

Hi, I am using jquery's change() to perform actions when SELECTs of a certain class are changed, however I do not want the last drop down in the DOM of this class to perform the action. I have tried $("select.prodOption").change(function(){ if($(this) !== $("select.prodOption").filter(':last')){ //do stuff ...

Why am I unable to tie into an iframe content changing event?

I am having an issue with jQuery, an iframe, and a third party component. (Richer Components rich text box, I suggest not using their product as they do not respond to issues on their forums, or at least have not for at least 5 years.) I am trying to have when a user types into a third party control an event fires. The control is a ric...

JQuery Multiple selector problem

<script> $(function(){ $("a.a, a.b, a.c, a.d").click(function () { alert('Hi'); }); }); </script> <a href="#" class="a button">Hi</a> The above JQuery unfortunately doesn't work. Probably an easy fix, any ideas? I need it to be a multi-selector, but with a's that have multiple classes unfor...

How to convert a jquery object to JSON string OR how to save a specific element in a string?

I added a click event to all elements on the page and now want to send the clicked target element to a server. If the clicked element has an ID, then I can just send the ID, but if the element doesn't have an ID, class, name, ... , then how can I send an identifier (or selector) to the server which points to this exact element? I tried ...

jQuery - Selecting a text box before a span tag with certain CSS class

Hello, I am a beginner in jQuery. It would be great if somebody could help me with this. I am not sure what's going wrong here. This is what I am trying. I have a element with class as "spanClass1". Before this element there is another element and a text box element. My requirement is to scroll to that text box element and gain focu...

Select ID in table ...

Hello, I have this code <% foreach (var item in Model.List) { %> <tr> <td><%: item.LastName %></td> <td><%: item.FirstName %></td> <td><%: item.IsEnable %></td> <td><a href="#" class="CustomerEdit">Edit</a></td> <td><a href="#" class="CustomerDetail">Detail</a></td> <td><a href="...

jQuery select last word after = (equal symbol)

I'm using $(this).attr("href"); to select the href attribute value of the clicked element, but I need to select only the part after the last '=' symbol. Example: href="index.php?con=123&id=123&sel=heyhey" I only need the last part of the href that is 'heyhey' How can I select this?? ...