selectors

Use JQuery to wrap multiple sets of elements in a Div

I'm working on a dropdown menu and need to mutate the existing html markup with JQuery to make it fit the design. Here is a simplified example: Wrap all "ul's" that contain more than one "li" in a div (in the same div, NOT one div for each UL). <ul> <li>foo</li> </ul> <ul> <li>foo</li> <li>foo</li> </ul> <ul> <li>foo</l...

jquery selector array

Hi, i am having an add to basket problem.Some products have options like color/size. I draw the select box for color/size and an input for qty. <select name="productOption[1234][color]"> <select name="productOption[1234][size]"> <input type="text" name="productOption[1234][qty]"> So option is an array that holds the values for each p...

jQuery selector help - Can I generate a selector from clicking on an element?

Hi All, I have jQuery, FireFox, Firebug, IE, and IE developer toolbar. When I am examing a page with either FireBug or IE Dev toolbar, I am able to click on an element and it shows me in the dom where the element is etc... Is there anyway to transform that selection into a valid jQuery selector? I know I can use ID, classes, and element ...

Find the class of the clicked item using Jquery

Hiya, I have the following code: $(".perf-row").click(function(e) { if (e.target.tagName.toLowerCase() == "a") { pageTracker._trackPageview($(this).attr("rel")); return true; //link clicked } else { window.open($(this).attr("rel"));return false; } }); to the conditional statment of if (e.target.tagName.toLowerCase() ...

Iphone SDK selector or abstract class

Hi, I am developing a special type of view controller for an iPhone component library. I have got the who view controller working well, but I need to change it so that it works in one of two ways: Either it is an abstract class which you must subclass and provider the implementation for a specific method which the controller will call...

jQuery - Getting Rows from a Table

Hey all, The title on this one may be a bit misleading as it's not as simple as it sounds. I've got a page with two tables (each has 50 rows) shown side-by-side so that the rows align with one another. The problem I'm facing is that the default height for a row in each table is the same but occaisionally dynamic content in the second ...

jQuery matching pattern

I'm trying to validate my inputs with jQuery before a form is sent. This is what my input fields look like when there is no value inserted in the database: <input class="field" type="text" style="background-color: rgb(255, 255, 255);" value="" name="input_18748_388_1257894000_"/> This is what my input fiel...

jQuery: How can you test for the *absence* of a class?

Given that this is the correct way to see if 'this' has class 'selected': if ($(this).hasClass('selected')) { // logic goes here } What is the correct way to test for the absence of a class? That is, how can I test if 'this' does not have class 'selected'? ...

how to capture the click event of a dynamically generated button in jquery

i see there is this syntax for detecting any button click <script type="text/javascript"> $(document).ready(function() { $(":button").click(function(event) { alert("Thanks for visiting!" + this.value); }); }); </script> but what if i want to only detect a particular button on the...

:empty pseudo selector with jQuery on a form element?

Is there a way I can use a jQuery pseudo selector like :empty or :not(:checked) on an input/textarea/select element, or any other way I can return an object that is empty? ...

jQuery select and filter contents of <option>

Hi, I have the following drop down menu: <select id="target"> <option value="0">Zero ($123.45)</option> <option value="1">One ($99.99)</option> <option value="2">Two ($4.50)</option> </select> Using jQuery, how can I select the contents of the selected option's () brackets, i.e. 123.45, 99.99 or 4.50? So far I have: $("...

PerformSelector Monotouch Threading

Using this statement calls the selector immediately instead of 6 seconds from now. this.PerformSelector(myStartWaitForSoundSelector, null, 6.0f); Does anyone know how to get this to work with a delay? I am using thread.Sleep(6000) in the function that gets called, but the entire app locks up for six seconds. Thanks ...

jQuery: select an element's class and id at the same time?

I've got some links that I want to select class and id at the same time. This is because I've got 2 different behaviours. When a class of links got one class name they behave in one way, when the same clas of links got another class name they behave differently. The class names are switch with jquery. So I have to be able to select a l...

jquery ajax get a pair of identical select menus to update each other - half working!

I'm improving a checkout page and have 2 identical 'country select' menus. One at the top of the page to calculate postage, and one at the bottom for entering delivery address. Our customers seem to have a lot of difficulty grasping that they need to pick the same country in both menus, or the price calculation will be incorrect. So wha...

Select last 5 elements with jQuery

Is it possible to select the last 5 child divs of an element? ...

Best way to select from a list - aren't the two listboxes getting a little old?

How many times have we seen this type of selector: I was just about to start creating this in a WinForms app, when I thought that others may have some ideas for doing this better. We need it to sort - so the right hand list will need up/down buttons. But this seems so old school. I love devexpress components, and was thinking of as...

Getting a range of elements in one jQuery selector

My problem is that I have a table, but I only want a subset of the rows, from first index to last index. I thought you could do it like this: $('table tr:gt(2):lt(5)'); I thought it would give you only rows #3 and #4 but it ends up giving you more than that. How can I tell the selector to choose only rows #3 and #4? ...

jquery selectors

Hi, I want to add class to <a>, what has some url. For exampe : $(document).ready(function() { var pathname = window.location.pathname; $(".navholder ul li a").each(function() { $(this).addClass('sel'); }); }); I want to add "sel" class to <a> what has href=pathname. Theoretically something like this :...

How to select nth line of text (CSS/JS)

How to select and apply style on a specific line of text? Like the CSS pseudo-element :first-line, but I want to select any line, not limited to the first. It seems that it can't be done by using only CSS... Anyway I don't mind a JS solution. Update: Well, actually it's only for interest. I'm trying to achieve something like highli...

jQuery selectors - find objects without specified attribute

I have several objects on a page and I want to perform an operation using jQuery only on some of them - the ones that don't have a specified attribute. So: <li style='...'>some text</li> <li style='...'>some other text</li> <li>some very diffrent text</li> and in javascript I would have: $('li[style]').hide(); that would hide all e...