jquery-selectors

How to get the child of an element being dragged with jQuery UI

I have the following html: <div id="gallery"> <ul> <li> <a href="url I want to get">link</a> </li> </ul> </div> and some jQuery that allows it to be dropped on another div: $trash.droppable({ accept: '#gallery > li', activeClass: 'ui-state-highlight', drop: function(ev, ui) { ...

how can i get all inputs excluding buttons and hidden fields with jquery?

I've got the following which will excludes all buttons, but how can I also exclude hidden fields? $("#selector").find(":input:not(:button)").each(function (i) { // do something I'm sure this is probably simple, I just can't find it. Many thanks! ...

How do I cache jQuery selections?

I need to cache about 100 different selections for animating. The following is sample code. Is there a syntax problem in the second sample? If this isn't the way to cache selections, it's certainly the most popular on the interwebs. So, what am I missing? note: p in the $.path.bezier(p) below is a correctly declared object passed to jQu...

jQuery .each() returns DOM element and not a jQuery object

I could be misunderstanding what is happening but from what I can tell I am getting a DOM element and not a jQuery object when I use .each(). The below will not work as this refers to a DOM element and not a jQuery object $("span[id$='_TotalItemCost']").each(function() { var someText = this.text(); }); Modified to transform this ...

jQuery selector for option tag value attribute returns null

Hello, I am trying to change the selected option in a select dropdown box with jQuery. I have it set so that it finds the hash tag at the end of the URL and based on that hash tag it changes the selected option in the select box. Most of my code is functional, it successfully finds the hash tag and executes the if statement that corresp...

How do I return a subset in jQuery plugin?

By default it's like this: $.fn.ellipsis = function() { ... return this.each(function(){ //do some operation on each element here to see if it qualifies } } But now I want to return a subset of all, only those qualify in this.each(function() {}), how to modify the code so that it finally returns only those that qualify? ...

Parent element selection problem?

My HTML is something like this <div id="mydiv" class="common"> <input type="text" id="text1" value="" /> <input type="text" id="text2" value="" /> </div> I am assigning a function on the onclick event of the textbox like this $(document).ready(function() { $(".common input").click(function() { //////// Wh...

Does IE have a max selector length?

I am using the statement given below to remove the check marks from a selected list when clear is clicked. It works perfect in FF and GC(google Chrome :-)) but not in IE. $("#divResults li span .ui-icon-check").each(function () {$(this).remove(); }); Any idea why this does not work in IE? Are there any specific limit in the number of ...

jQuery: is there a way to make a recursive child selector?

instead of checking only the immediate children of an element, i would like to recursively check all children of the element. specifically, something like $("#survey11Form>input[type=text]:visible").val(); with the html: <form id="survey11Form" name="survey11Form" action="#" method="post"> <div id="survey11Div"> ...

Optimizing jQuery for Tabs

I am in the process of developing a widget. The widget has three tabs that are implemented in the following way. <div id="widget"> <ul id="tabs"> <li><a href="http...">One</a></li> <li><a href="http...">Two</a></li> <li><a href="http...">Three</a></li> </ul> <div id="tab_container"> <div i...

How to get img inside a particular div using JQuery

I have to get all the image tags ids inside a particular div. How can I get that using JQuery? ...

jQuery returning two elements for each one it finds?

I'll start by saying I'm fairly new to jQuery. For the most part, I've found it intuitive and powerful, but this one circumstance has me thoroughly stumped. In the following method, the call to .each() returns two elements for every one found. It iterates over a set of table rows given IDs starting with the word, "communication," and fo...

I'm trying to select the adjacent sibling of "this" in jquery

$(this+"p").slideDown("slow"); $(this)+$("p").slideDown("slow"); $("this+p").slideDown("slow"); does not work. ...

Selecting an option by its value

I'm trying to run this jQuery selector: $("#label option[value=\"newLabel\"]") On the following code: <select name="label" id="label"> <option value="1" label="testLabel">testLabel</option> <option value="newLabel" label="New Label">New Label</option> </select> But the selector just won't find it - can anyone spot where ...

Is there a better way to select tables based on how many rows they have via jQuery?

I'm looking to grab a group of tables that have more than X rows with jQuery. Currently, I'm doing something similar to: $("table").each(function(){ if($(this).find("tr").length > x){ tableArray[tableArray.length] = $(this); } }); and then acting on the members of the tableArray. Is there a better way of getting these tables,...

JQuery: How replace text AFTER a nested tag?

I'm trying to figure out the jQuery statement to rename "apple" with "orange:" <a id="alvin" href="http://www.camille.com"&gt;&lt;ins class="xxx">Anna</ins>apple</a> Can this be done easily? ...

jQuery - search for previous selector relative to current

I have a form with 3 sections in it. Each section has a dedicated div for fairly long contextual help messages regarding the input that has focus. My question is, if I give each of these help divs a class of "form-tip" and each input that has a tip the class "has-tip", how can I get the tip to always show up in the previous "form-tip" ...

Is there a way to detect elements inside a parent element?

I would like to detect all the elements insides a parent element and still check if the child has child elements and detect them also. For Example: <div id="first"> <div id='second1'></div> <div id='second2'> <div id='third1'></div> <div id='third2'> <div id='fourth1'></div> <...

Jquery (this) selector help

Hi. I have the following HTML: <div class="box"><img src="pic.jpg" alt="image" /></div> <div class="box"><img src="pic.jpg" alt="image" /></div> <div class="box"><img src="pic.jpg" alt="image" /></div> <div class="box"><img src="pic.jpg" alt="image" /></div> I am trying to select the div and the child image both at the same time. I ne...

Jquery find behavior in firefox 3.5.9

Hi, i have the following piece of HTML code on my page: <tr> <td> <div> <input type="hidden" name="test" value=""> <input autocomplete="off" class="ffb-input watermark"> <div class="ffb"> <div class="content"> </div> </div> </div> </td> </tr> In JavaScript I get the <tr> element usin...