selectors

How do I get jQuery to select elements with a . (period) in their ID?

Given the following classes and controller action method: public School { public Int32 ID { get; set; } publig String Name { get; set; } public Address Address { get; set; } } public class Address { public string Street1 { get; set; } public string City { get; set; } public String ZipCode { get; set; } public String State...

jQuery: Can I do $('.superset').$('.within') instead of $('.within', $('.superset'))?

Can jQuery be extended so that I can use the above syntax? I can't figure out how to prototype whatever it is $() returns, so that I can call $().$() Thanks. ...

jQuery - looking for a better selectors syntax

I've got HTML code that roughly looks like this: <li id="someid-11"> <img src="..." alt="alt" /> <h2><a href="somelink"> sometext </a> <span><a class="editcontent" href="?action=editme">Edit</a></span> </h2> <div id="11" class="content"> <!-- // content goes here --> <div class="bottom_of_entry"> </div> </li> I'm using the a.e...

What is the replacement for the child selector ?

Since IE6 does not support the child selector (see http://kimblim.dk/csstest/#ex1), what is the alternative when dealing with this browser? I do not want to modify the markup, and I'd much much prefer a CSS-only solution... And yes, it is the direct child that I wish to target. Thanks! ...

jQuery: exclude $(this) from selector.

Hi. I have something like this: <div class="content"> <a href="#">A</a> </div> <div class="content"> <a href="#">B</a> </div> <div class="content"> <a href="#">C</a> </div> When one of these links is clicked, I want to perform the .hide() function on the links that are not clicked. I understand jQuery has the :not selecto...

select a div's all links but not child divs' links

Hi, Please help... How can I code at Jquery, "Selecting a div's links but not child divs' links of that div? Thanks. Best Regards. ...

How do you select elements based on their style?

Using jQuery, how would you find elements which have a particular style (eg: float: left), regardless of whether it's an inline style or one defined in a CSS file? ...

jquery - How to select all content between two tags

I have a document with headings and unordered lists. How can I use JQuery to select a given heading (by its unique class name) AND all content between that heading and the next heading? ...

Mootools - Targeting child elements with an .each selector

I'm trying to target a UL that's inside a LI and I'm having trouble. Here's the HTML: <ul id="main_nav"> <li class="main"><a href="#">Section 1</a> <ul id="dropdown"> <li><a href="#">Item 1</a></li> <li><a href="#">Item 2</a></li> <li><a href="#">Item 2</a></li> </ul> </li> <li class="main"><a href="#">...

How to select an element that has focus on it with jQuery

How can you select an element that has current focus? There is no :focus filter in jQuery, that is why we can use something like this: $('input:focus').someFunction(); ...

E#myid vs. #myid CSS Selectors

I'm curious what the difference is b/w E#myid vs. #myid (E is any element) given that there can only be one element with #myid on a page? ...

problems with a jquery selector

Here is my view source: <input id="ctl00_cp_ctrlNew_lendeeMe" type="radio" name="ctl00$cp$ctrlNew$whoBorrowed" value="lendeeMe" /> And I am trying to use this selector to check one of them, but it is not working: $("input[@id$='lendeeMe']").attr('checked','checked'); but if I do this, it works fine: $("#ctl00_cp_ctrlNew_lendeeMe")...

JS/jQuery: How can I select the first LI item of an UL navigation when hovering over another (lower) LI element?

Hello again. I am trying to make a navigation that uses simple unordered lists to list all the links. Basic stuff. However the first LI element has a class name of "section-title". following this 'section-title' are the links to the other pages. Now i would like to change the background color of the li.section-title to black while hove...

Speed/redundancy of selectors in CSS

Does anyone have information on browser selector speeds in CSS? In other words, how different selectors compare to each other (in th same browser). For example, I often see (and write) code like this: #content #elem { ...rules... } But since those elements are unique IDs, I should only need #elem, right? This got me thinking about wh...

How do I use jQuery to ignore case when selecting?

I'm currently attempting to disable a link using the following jQuery selector: $("a[href$=/sites/abcd/sectors]").removeAttr("href"); The problem is that sometimes the href might not always be lower case on the page. When this happens the selector no longer matches. Does anyone know how to get around this? Can I change the behaviour ...

Can jQuery selectors be applied to an element rather than the whole document?

jQuery('td[class=bgoff]').each(function() { var td = jQuery(this); ... no apply selector to "this" only }); I'm working with tabular data in html and trying to parse the contents of each TD (they are not uniquely identifiable). Using XPath, I can prepend the path of "this" to additional selecting. How can I achieve this with...

Where is this JQuery wrong?

I want to add the click event to all elements where the `id="violacao": $(document).ready(function () { jQuery('#violacao').click(function() { alert('teste'); }); }); But just the first link responds to the click. This is the HTML generated: <tr> <td><a href="#" id="violacao">40954589</a></td> <td>Perda de Comunic...

jQuery: Adding context to a selector is much faster than refining your selector?

I just noticed that adding context to the selector is much faster than refining your selector. $('li',$('#bar')).append('bla'); Is twice as faster than: $('#bar li').append('bla'); Is this generally true? ...

jQuery: Multiple element selection

I'm using jQuery 1.3.2: <script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script> I've got the following html: <div id="container-div"> <div id="package_1"> <div>Package_1</div> <div id="package-content"></div> </div> <div id="package_2"> <div>Package_2<...

IE8 css selector

To target elements only in IE browsers i'll use IE6: * html #nav li ul { left: -39px!important; border: 1px solid red; } IE7: *+html #nav li ul { left: -39px!important; } Does anyone know how to target IE8? ...