jquery-selectors

jquery variable inside live function not working

I have this piece of code $('ul.fonts li', '#wizard').live('click', function(e){ $('ul.fonts li', '#wizard').removeClass('selected'); $(this).addClass('selected'); $('blockquote').css('font-family', $(this).find('a').attr("class") ) e.preventDefault(); }) I tried ti optimize this code storing the selector in a variable. var $fonts_li...

How do you test whether a field is of type "select" in jQuery.

How do you test an input field for type "select", e.g. for a radio button, it's if($('#' + field).attr('type') == 'radio'{ .... } What do you write for a select box? ...

Toggle blog articles (expand/collapse) with jQuery

Hi, in my blog some articles are very long. So I want the long articles to be collapsed when the page is loaded. It works for me for just one article but if I have more articles something seems to be broken. Here's how I do it: $('div#ttoggle').hide(); $('#btoggle').click( function() { if($('div#btoggle p').text() == 'expand artic...

Jquery select class from variable

Hi, I am using Jquery to find a class by variable. So, var className = "whatever"; $("#container ul li") if contains element with className, do this How do I write the above code? Is it $("#container ul li").find("."+ className).each(function(){ console.log("I found one"); }); Obviously the code doesn't work ...

jQuery: selectors with OR condition

I've got following code: $('table.tableElements thead|tbody tr').children().hover(function(){ // How can I do this ↑ }); I'd like to catch all tr's of thead OR tbody but not tfoot. How can I do this? ...

Are there any text selector in jquery ?

Are there any text selector in jquery ? My Code <anything>Hello World! Hello World!</anything> Reslut Should be (Using Jquery) <anything>Hello <span>World</span>! Hello <span>World</span>!</anything> ...

jQuery $("img[src=the_image_souce]").attr('src','new_src'); does not work

My code does not work I don't know why the_image_source and new_src are just place holders I have put real values in them I have also tried $("img[src=the_image_souce]")[0].attr('src','new_src'); but it does not work either, please help ...

I cannot select <title> tag in Atom XML using jQuery.

I get Atom data through Ajax using jQuery. I write $(xhr).find('entry id').eq(0).html(); is OK. But $(xhr).find('entry title').eq(0).html(); can not select anything. title tag is actually exist. Please help. Thank you! ...

a way to make adding and removing classes on a table faster?

I have a large table with 27 columns and between 5 to 100 rows. I have mode switch (checkbox) that switches the view of a table from the first 5 columns (simple) to 27 columns (expert) and back. Currently I use the following jquery method to switch between the modes: $("#ToggleTableCells").click(function(){ if($(this).is(':checked...

jQuery Selectors | Complex Selection

Hi there, I have a list like that: <div class="cloned"><a rel="test" href="" title=""></a></div> <div><a rel="test" href="" title=""></a></div> <div><a rel="test" href="" title=""></a></div> <div><a rel="test" href="" title=""></a></div> <div class="cloned"><a rel="test" href="" title=""></a></div> I would like to use jQuery to sele...

jquery v1.3.2 find element by attribute or cssclassname

hi I am using a list view for showing selection marks. <asp:listview id="lvanswerlist" runat="server"> <layouttemplate> </layouttemplate> <itemtemplate> <asp:Panel ID="Idanswercontent" CssClass="answer" runat="server"> <div class="bestAnswerControl"> <div id="divBestAnswer" class="bestAnswer" runat=...

help in jquery selector

I am using a jquery selector $('input,select,textarea').not('table input').attr('disabled',true); here I am disabling all input, select, and textarea control. but I dont need to disable any control that is in a table. I have done it using .not('table input') but I also need to mention select along with input control in a table. I hav...

How to apply JQuery function to all elements except some elements ?

Hello, I am kind of stuck on this one. I have webapp where I use simple JQuery plugin: $.extend($.fn.disableTextSelect = function() { return this.each(function(){ if($.browser.mozilla){//Firefox $(this).css('MozUserSelect','none'); }else if($.browser.msie){//IE $(this).bind('selectstart',funct...

jquery selector needed to select next table from element

hi, I need a selector that basically starts at the element that I have clicked and finds the next item with a certain class on the page. See my example below: <table> <tr> <td>Blah blah blah</td> <td><p class="click">Fire jquery</p></td> </tr> </table> <table class="hidden"> <tr> <td>blah blah blah</td> <td>blah blah blah</td> </tr> </...

Writing jQuery selector case-insensitive version

I'm using following line and I would like to make it case-insensitive: var matches = $(this).find('div > span > div#id_to_find[attributeName ^= "filter"]'); if (matches.length > 0) { } My question is that how can I make the selector ^= to be case-insensitive? Maybe changing to filter and then some regexp? ...

jQuery - Dynamic Selector, not sure why its not firing.

Below is a static example of me triggering the scroll event. It will alert the 'Dynamic Selector', the alert result in this case is: #WordPanel #AZ-List div div div.ui-jqgrid-bdiv (That's right its the same as the static select ive typed in the example below) $("#WordPanel #AZ-List div div div.ui-jqgrid-bdiv").scroll(function() { ...

jQuery selector for each first element on every parent

I have a HTML like this: <div class="container"> <span class="iconset"></span> <!-- want to select --> <span class="iconset"></span> </div> <div class="container"> <span class="iconset"></span> <!-- want to select --> <span class="iconset"></span> </div> I need to select the first element of every .container, using: $...

How is :contains() supposed to be used?

I'm new to jQuery, but just attempting to create a function I can use to filter a table. I've got the table set up so that I can select all the rows by the class (which works fine) and call each() on the result. Inside the callback to each() I've got this if statement: if ($(this).find("td[name=firstName]:contains('ke')").size() > 0) ...

Jquery select an element containing multiple classes with based on user input

Hi, I have an input field '#q' where a user can type a search query and returns a set of list items whose classes match it. function queryData() { q = $('#q').val(); q = q.toLowerCase(); var qs = q.split(' '); $('.item').fadeOut(300); for (n in qs) { $("li[class*='" + qs[n] + "']").fadeIn(1000); ...

jquery selector needed to select all certain children of parent

Hi, I have a page with some tables on it. In each table the first row is normal but the rest of the rows have a class of hidden so that they are not displayed on load. In one of the cells on the first row of the table there is a link to click to view more details (fade in the hidden rows of that table). I'm struggling to get this to work...