jquery-selectors

Filter not functioning, need only the tags whose child match a selector

given the html: <div class="ships"> <div class="ship header"> </div> <div class="ship"> <div class="image"> <img alt="Hermes_class" src="..." /> </div> <div class="number">x10</div> </div> ... //other ships I want only the number text of the ship matching img alt="Hermes_class". Here's where I start: var f...

validate dynamically added textbox

In the below code how to validate for null values for only the dynamically added text box i.e,r_score1,r_score2......... <script> function validate() { //How to validate the r_Score.. textfields } $(document).ready(function() { for(var i=0;i< sen.length;i++) { row += '<input type="text" name="r_score'+i+'" ...

This should be real easy. How to find a button through its Value (Jquery Selector)

I have this HTML: <div id='grid'> <input type="button" value="edit"/> <input type='button' value='update'/> </div> How to I attach a click event only to Update button. I know I could add a class to it or specity an id but both are not possible since it is in gridview. I tried this: $("input:button[@value='update']").click(function()...

Is there a 'has focus' in JavaScript (or jQuery)?

Is there something I can do like this (perhap via a plugin) if ( ! $('form#contact input]').hasFocus()) { $('form#contact input:first]').focus(); } Basically, set focus to the first input, but only if the user has not already clicked into anything? I know this will work too, but is there anything more elegant? $(function() { var...

JQuery Internals Documentation

Is there any documentation available that explains the internals of JQuery and JQuery UI? I have been looking through the source code, and while much of it makes sense, I was still hoping for an overview/walkthrough of the source code to help speed up my learning process. I'm not looking for general documentation of how to use JQue...

jQuery selectors: select two elements, and all elements in between

I have a load of LIs inside an UL, and each one has a unique ID. Given two IDs, what's the best way to select the two corresponding LIs, and all the LIs in between? Thanks! ...

jQuery select element containing a link that contains any element of array

Hi, I am trying to work out a complicated jQuery selection. I have an array, and I need to select div.foo that contains a link a.bar and the link's href contains any of the strings in the array. For example: <html> <div class=foo> some text <a class=bar href=example.com?q=widget&id=23456789>search</a> </div> </html> and jScrip...

not able to get a processed list in jquery variable

I have html list <ol id="newlist"> <li>Test <ol> <li>1</li> <li>2</li> <li>3</li> </ol> </li> <li>Another test <ol> <li>1</li> </ol> </li> <li>Cool Test <ol> ...

jQuery: select all inputs with unique id (Regex/Wildcard Selectors)

I have some textboxes on a webform that have ids like this: txtFinalDeadline_1 txtFinalDeadline_2 txtFinalDeadline_3 txtFinalDeadline_4 In my jQuery how do I find all of those in order to assign a value to them. Before I had the underscore and they were all named txtFinalDeadline I could do this and it worked. $(this).find("#txtFinalDe...

Deselect an ID that would otherwise be selected by class

I have a page where all inputs are assigned a behavior: $("input").blur(function () { and I need to exclude a checkbox that has a specific id: <input type="checkbox" id="allButMe" onchange="billingSameChanged();" value="true"/> thx ...

jquery select one class from many

Hi, I'm trying to achieve the following functionality. Within a form I have multiple fields with the class name .inputField if one of these fields is selected then the div associated with that element should be shown on focus and hidden on blur. However, when I implement the code below on selecting the second element the class is appl...

Getting jQuery function to fire when video is clicked

I've set up a function to pause the sound in an mp3 player whenever certain things are clicked on the page, using ExternalInterface, but I'm having a problem in IE. The setup is this: I have a video page that calls up a list of YouTube videos using RSS. The most recent video is displayed on the page in a div called "display". Then al...

jQuery: How to find elements *without* a class set

Hey jQuery clever peeps, Why does this fail... $( 'div.contactAperson input' ).not( 'input.hadFocus' ).focus(function() { $(this).attr('value', '' ); }); ...it's meant to sniff out input's that have not got the class .hadFocus and then when one of that subset receives focus it should zap the value to null. Right now, input value...

Opposite of .find()

Is there an opposite of .find()? Where $('.myclass').except('#myid'); Would grab all elements with .myclass except the element with #myid. I know I could do $('.myclass[id=myid]') in this example, but seems like it would be helpful in other cases. Thanks EDIT: Thanks for the responses! Looks like I just missed seeing .not() and :not...

Is there a way to highlight specific words or numbers without inserting a span tag?

I've got blocks of text with various specs in them and want to have jquery highlight whatever matches a specific pattern without inserting any extra html. The following is the kind of text that I've got to work with. Intel® Core™ i7 Processor 920 (2.66GHz, 8MB cache, 4.8GT/sec)/ Genuine Windows® 7 Home Premium 64bit- English/ 640 GB S...

Help me diagnose this jQuery loop / Bookmark Hash problem ?

I'm having some trouble getting my jquery to render correctly 100% of the time - the code I am using is located below. Its purpose is to "simulate" the feel of a threaded forum by hiding everything but the subject of replies - when a subject is clicked, the 1st post is then replaced with the reply. You can see an example of it in actio...

jquery menu ul li

i have a tree menu that i need to open on specific branch. 1. on click on an A element i open the all next UL. now i want to close all other UL exept the ones that are parents of the A element. i want to write a function that will get an argument that is a A ID and will open the menu in the right place. my jquery code $(docu...

jQuery selecrors. help for newbie

Hello. I have this code, which open new jquery-ui dialog and then hide the dialog's titlebar. <div id="keyboard" class="keyboard dialogs">...</div>   $("#keyboard").dialog({ width: 1136, height: 437, position: ['center',400], closeOnEscape: false, autoOpen: false, resizable: false, open: f...

Getting value from href using jQuery

Hi, I wonder if anyone can help with a jQuery problem I am having. I am using the tooltips from the Jquery Tools library to create a popup window when mousing over an hrefed image, this I want to use to cusomise the call to change the content in the DIV. The links I am using are in the form: <a href="/venue/1313.htm" class="quickVie...

jQuery selector loads images from server

Hi! here is the code: <script type="text/javascript"> var ajax_data = '<ul id="b-cmu-rgt-list-videos"><li><a href="{video.url}" '+ 'title="{video.title.strip}"><img src="{video.image}" '+ 'alt="{video.title.strip}" /><span>{video.title}</span></a></li></ul>'; var my_img = $(ajax_data).find('img'); </scr...