jquery-selectors

multiple selectors jquery

This: $('input.people').attr('checked', false).filter('[name=toddS]').attr('checked', true); will select a checkbox with the class of people and the name toddS while unchecking all of the other boxes. How do I add another name to the filter? I've tried several different combinations and nothing works. This is what I have: $('input...

combine jquery calls into 1 function

Hi, I have the following jquery which animates on hover: $('#footerNetwork').hover(function(){ $('#popupNetwork').animate({top:'-62px'},{queue:true,duration:500}); }, function(){ $('#popupNetwork').animate({top:'30px'},{queue:true,duration:500}); }); $('#footerPort').hover(functio...

Jquery add status for a repsonse

<form> <input type="checkbox" id="m_q" name="m_q" value="271">Name</input><div name="status"></div> <input type="checkbox" id="m_q" name="m_q" value="271">Age</input><div name="status"></div> <input type="checkbox" id="m_q" name="m_q" value="271">ID</input><div name="status"></div> <input type="checkbox" id="m_q" name="m_q...

Get select values and radio values using jquery

Hi all, I have the following set of html for both radio and select box i want to get the value with comma seperated FOR RADIO BUTTON <div class="element" id="radio_gender"> <div class="fleft"> <label for="gender">Gender</label> </div> <div class="fleft"> <input type="radio" value="Male" name="gender" />...

jquery child selector without parent

I was looking at some code from a tutorial for creating a carousel menu and noticed parent child selectors without the parent. Never seen this before, and confused to what it is actually doing. See following code: var $wrapper = $('> div', this).css('overflow', 'hidden'), $slider = $wrapper.find('> ul'), $items...

Get the selected child within an .each loop in jQuery

Hey guys. I am trying to get the selected option in an each loop. What is the correct syntax to achieve that? I tried the following: var row = $('#template_23423); row.find('select[name^=COUNTY]').each(function (){ var selectedOption = $(this).children(':selected').val(); Any ideas? ...

jQuery: finding ancestors siblings with matching content / tree walking

<table> <tbody> <tr> <td class="TargetRow">Not this one</td> </tr> </tbody> <tbody> ... </tbody> <tbody> <tr> <td class="TargetRow">This one</td> </tr> </tbody> <tbody> ... </tbody> <tbody> <tr class="ContextRow"> ... </tr> </tbody> </table> Given the above HTML ...

How do I check with jQuery if an element has at least one class, from a list of specified classes?

Example html: <div class="red"></div> <div class="green"></div> <div class="blue"></div> <div class="apple"></div> I want to loop through the divs and filter them out if they don't have a class of either 'red', 'green', or 'blue.' var onlyColorDivs = $('div').hasClass( ____ ); Is there a way to fillin the blank in the previous line...

How to iterate through only the text box elements in the form using jquery

I have a form which contains 4 text fields when the button is clicked we should see that atleast one of the textfield should contain the value and the form should get submitted and the form also contains the Button which of input type too .I want only textbox field values $("#mybutton").click(function(){ $(":input").each(function(...

Attribute Selectors on jQuery UI Draggable

I'm working on a project that involves a fair amount of drag and drop among different category items (e.g. Fabric, Pins, etc). With my current setup, each of these elements is given a unique id code (e.g. F001 for a fabric). I'm trying to get the droppable point to look at the starting letter, and handle it from there. The roadblock I'v...

Set attribute selected of particular option of select box using jquery

Hi all, I have a select box with following options select id="box" ><br/> option value="1"Same Day<br/> option value="5">96<br/> option value="4">72<br/> option value="3">48<br/> option value="2">24<br/> select> I Want to add attr selected to option value '4' , i know i can show it selected via $("#box").val(4) But this...

Replace value in unordered list (html) + JQuery

Hi, I got this: <ul id="navigation"> <li id="nav-d1"><a href="#d1"><span>D1</span></a></li> <li id="nav-d2"><a href="#d2"><span>D2</span></a></li> <li id="nav-d3"><a href="#d3"><span>D3</span></a></li> </ul> I need to change just the values between <span> and </span> D1, D2, D3 with JQuery, with ...

In jQuery, is the selector $('[id=foo]') less efficient than $('#foo')?

In jQuery, is the selector $('[id=foo]') less efficient than $('#foo')? ...

jquery parent descendant selector

Why is 1 faster than 2? $('#p1').find('span'); $('#p1 span'); ...

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

JQuery set attribute of an element

In the following code <script> $(document).ready(function() { if(load_flag == 0) { var html = ''; html += "<div id ='err_msg' style='display:none;'><b>Preview errors</b> <br></div>"; html += "<div id ='cont' style='display:none;'><input type='button' value='Continue' onclick='javascript:s...

Incrementally hide items from a set of matched li elements with each button click using hide(), then show() entire set at end of set

Hi, I am new to jQuery and I am having trouble with the syntax, selectors and refining when trying to create functions. I was hoping someone might be able to help. What I am trying to achieve: I have a gallery consisting of a ul with images placed in vertically stacked list items. The ul is in a fixed size wrapper with overflow:hidden ...

updating line totals on an order form with jquery

Hi, I have a form on an order page which I need to update line totals on when the user changes the quantity. I have the grand total working, but cannot get line totals because I cannot figure out how to target the correct element. The form is generated by a cms so ends up wrapped in lots of extraneous divs etc, ...this is a simplified...

Delete table row in jquery

i have a table and a hidden field inside a td in it which stores the primary key .while deleting the table row i like to retrieve this value and add it to another hidden field i want to retrieve the data in hidden field for this deleted row ?? ...

How can I get the corresponding table header (th) from a table cell (td)?

Given the following table, how would I get the corresponding table header for each td element? <table> <thead> <tr> <th id="name">Name</th> <th id="address">Address</th> </tr> </thead> <tbody> <tr> <td>Bob</td> <td>1 High Street</td> </tr> ...