jquery-selectors

Select a tag nested within a ":last" selector

What is the selector syntax to select a tag after using the ":last" selector? <table> <tr> <td> Cell 1 </td> <td> <table> <tr> <td> The tag I want to get </td> </tr> </table> ...

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

using variables in rel attribute in jquery selector

I'm using the rel attribute to match a div to a button. I use the button's id in the corresponding div's rel field. There are multiple buttons. When a button is clicked I want to show the corresponding div with the show() method, and to hide the other divs. The buttons work fine, but the divs are not responding. My gut says I'm not fo...

Hide all but $(this) via :not in jQuery selector

Advanced title, simple question: How to do the following in jQuery: $("table tr").click(function() { $("table tr:not(" + $(this) + ")").hide(); // $(this) is only to illustrate my problem $("table tr").show(); }); Thanks in advance! ...

How to judge whether selected result is empty or not with jQuery?

$("#experiences tr") For the above one,how to judge if it's empty or not? I thought its boolean value should be false,but seems not. ...

jQuery selector problem

Hi! I have this selector: $("table.details tbody tr:not(.details)") But I'm wondering why this inner table gets selected too: <table class="items details"> <thead> <tr> <th style="width: 90%;">Test application</th> <th style="width: 10%;">Sent to test</th> </tr> </thead> <tbody> ...

jQuery :has(.something:contains()) unsupported?

Given the HTML below, I am trying to use jQuery to match all the list items that have a span with the class "foo" and that span should contain the text "relevant". <ul> <li>Some text <span class="foo">relevant</span></li> <li>Some more text <span class="foo">not</span> <span class="bar">relevant</span></li> <li>Even more <span ...

jquery selectors problem

I have an issue using jquerys selectors when it comes to a page I am populating from a database. The database populates a which will display 4 <li> tags per row for x amount of rows. I am trying to use addClass to give the first and last result on each row of the <ul> a different class. I have tried :first and :last but these obvious...

[jQuery] A nice selector to remove this horrible code...

Hi, can anyone offer a selector to do away with this horrible chunk of code: // img is the image element... var descriptionContent = $(".descriptionContent", img.parent("td").parent("tr").next("tr")); The html looks like this: <table> <tr> <td><img /></td> </tr> <tr> <td><div class="descriptionContent" /><...

jquery: exclude checkbox from selection within table row

I have a table and have a jquery script that does two things: 1) When a row gets moused-over, the background color is changed by adding a hover class 2) The link contained in the row is used to make the entire row a link. <script type="text/javascript"> $(document).ready(function() { var target = 'table.mytable tr.allrows'; va...

Use attribute or selector

Which is better to select textbox: input[type=text] or input:text Which to use? ...

jQuery Selector Problem (All Children inside Div)

Hello, I'm trying to attach a click function that adds a CSS class to all anchor tags inside of a specific div. Somehow I can't get jQuery to do this (no JS error either). The div: <div id="better"> <a href="1.aspx">One</a> <a href="2.aspx">Two</a> <a href="3.aspx">Three</a> </div> My jQuery code (inside of $(document...

jQuery Remove CSS Class from all Descendants at once

Can I remove a specific CSS class from all XYZ elements within an element at once? Example: Remove CSS class "active" from all <a> anchors within my search <div>. If so, how? ...

jQuery find selector problem

I got such code: $('.mainp').find('A[href$=jpg]','A[href$=jpeg]','A[href$=gif]','A[href$=png]').fancybox(); And it works only for .jpg files. When I change it to: $('.mainp').find('A[href$=png]').fancybox(); It works for .png files. So what I'm doing wrong, that fancybox() is not working with all type of files? ...

Jquery selector problem

I have two in a table with ids row_26 and notificationrow_26. notificationrow_26 is dynamically added to DOM after page has been loaded. I want to highlight notificationrow_26. So I use var deviceUID = 26; $("#notificationrow_" + deviceUID).effect("highlight", {}, 3000); but when I do this. It does not highlight that row. I also tri...

jquery selecter that filters out animated children

I am trying to have a jQuery selector to select a element only if its children are not animated. I tried: var articalLink = $(".navArticals").filter($(this).children("ul:not(':animated')")); It doesn't work It turned out that only this works var articalLink = $(".navArticals").filter(function() { var filtered = $(this).childre...

jQuery selectors stored as properties in a namespace

I am working on refactoring a JavaScript namespace for a site. The namespace leverages jQuery for selectors and events. Here is an example. MyNamespace = { eventElements : { headerSectionA : $("h1.section-a"); headerSectionB : $("h1.section-b"); } sectionA : function() { // do stuff for section A here...

How to select all links whose protocol is not http with jQuery?

Suppose that you have: <a href="file://...">link1</a> <a href="file://...">link2</a> <a href="http://..."&gt;link3&lt;/a&gt; <a href="http://..."&gt;link4&lt;/a&gt; What code should I use to select only link1 and link2 without using a[href^=http]? ...

find a div and store its name into a a variable

hi all, I have a div called album_number_xx (xx being digits). this div contains another set of divs, each one representing an image with caption and other details. I need to allow the user to reorder images by drag and drop, and then update the database with the new order. using jQuery sortable and serialize, I'm able to get the seq...

JQuery selector problem in Internet Explorer

Hi! I have a jquery selector that looks like: var val = "John's cars"; $('#subject input[value="'+val+'"]') This works just fine in Firefox, Chrome, Internet Explorer 8, but not in IE 6 or IE7. The problem is the ' in the text search for. Someone has any idea how to work around this problem except to loop through all inputs in questi...