Re: [jQuery] Selector question
Sorry I meant this ones $('td').children().is('[EMAIL PROTECTED]') works OK $('td').children('[EMAIL PROTECTED]') Doesn't work -- Kush Murod wrote: Hi guys, This works ok $('td').children().is('img :[EMAIL PROTECTED]') Having said that I assumed I could also achieve same result by doing this $('td').children('img :[EMAIL PROTECTED]') and expected the same result, but not Can anyone clarify this. --kush ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selector question
thanks heaps Klaus and Jake, this is gold replies :) Klaus Hartl wrote: Kush Murod schrieb: Hi guys, This works ok $('td').children().is('img :[EMAIL PROTECTED]') Having said that I assumed I could also achieve same result by doing this $('td').children('img :[EMAIL PROTECTED]') and expected the same result, but not Can anyone clarify this. --kush is() returns true/false, so it is something different than using children() I'd simplify that anyway: $('td').children('[EMAIL PROTECTED]') or even: $('td[EMAIL PROTECTED]') -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selector question
The is() function returns true or false, the children() function returns a set of jQuery objects. So: $('td').children().is('img :[EMAIL PROTECTED]') Will return TRUE if the children contain atleast one img element with src attribute containing 'albled' or FALSE otherwise. While: $('td').children('[EMAIL PROTECTED]') Will return all the ELEMENTS that are imgs with src attribute containing 'abled'. Hope this clears things up. - jake On 3/28/07, Kush Murod [EMAIL PROTECTED] wrote: Hi guys, This works ok $('td').children().is('img :[EMAIL PROTECTED]') Having said that I assumed I could also achieve same result by doing this $('td').children('img :[EMAIL PROTECTED]') and expected the same result, but not Can anyone clarify this. --kush ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selector question
thanks heaps Klaus and Jake, gold reply :) Klaus Hartl wrote: Kush Murod schrieb: Hi guys, This works ok $('td').children().is('img :[EMAIL PROTECTED]') Having said that I assumed I could also achieve same result by doing this $('td').children('img :[EMAIL PROTECTED]') and expected the same result, but not Can anyone clarify this. --kush is() returns true/false, so it is something different than using children() I'd simplify that anyway: $('td').children('[EMAIL PROTECTED]') or even: $('td[EMAIL PROTECTED]') -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selector question
why not just $('ul li div.linkSubMenu ul.detailSubnav li a.selected').show() ? or even just $('a.selected').show() or you can set it in css a.selected { display: block; } dennis. Alexandre Plennevaux wrote: hello ! i have a menu which structure for each item is: (1) ul li div.linkSubMenu ul.detailSubnavlia except for the selected menu, which is: (2) ul li div.linkSubMenu ul.detailSubnavlia.selected on load, all div.linkSubMenu are hidden (via css: display:none) i would like that the selected one (2) be shown. I don't know how to target it via jquery, can you help me out? thank you! alex Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte Lakensestraat/Rue de Laeken 104 B-1000 Brussel-Bruxelles-Brussels Belgie-Belgique-Belgium Tel:+32(0)2.219.65.55 Fax:+32(0)2.426.69.86 Mobile:+32(0)476.23.21.42 http://www.lab-au.com blocked::http://www.lab-au.com/http://www.mediaruimte.be blocked::http://www.mediaruimte.be/ blocked::http://www.mediaruimte.be/__ The information in this e-mail is intended only for the addressee named above. If you are not that addressee, please note that any disclosure, distribution or copying of this e-mail is prohibited. Because e-mail can be electronically altered, the integrity of this communication cannot be guaranteed. __ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date: 27/03/2007 16:38 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selector question
Try $('a.selected').parents().show(); as you need to show the parent elements, not the link. Cheers, -js On 3/28/07, Alexandre Plennevaux [EMAIL PROTECTED] wrote: hello ! i have a menu which structure for each item is: (1) ul li div.linkSubMenu ul.detailSubnavlia except for the selected menu, which is: (2) ul li div.linkSubMenu ul.detailSubnavlia.selected on load, all div.linkSubMenu are hidden (via css: display:none) i would like that the selected one (2) be shown. I don't know how to target it via jquery, can you help me out? thank you! alex Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte Lakensestraat/Rue de Laeken 104 B-1000 Brussel-Bruxelles-Brussels Belgie-Belgique-Belgium Tel:+32(0)2.219.65.55 Fax:+32(0)2.426.69.86 Mobile:+32(0)476.23.21.42 http://www.lab-au.com http://www.mediaruimte.be __ The information in this e-mail is intended only for the addressee named above. If you are not that addressee, please note that any disclosure, distribution or copying of this e-mail is prohibited. Because e-mail can be electronically altered, the integrity of this communication cannot be guaranteed. __ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date: 27/03/2007 16:38 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selector question
Because it is its container, 3 levels above that is hidden . -Original Message- From: spinnach [mailto:[EMAIL PROTECTED] Sent: mercredi 28 mars 2007 20:38 To: [EMAIL PROTECTED]; jQuery Discussion Subject: Re: [jQuery] Selector question why not just $('ul li div.linkSubMenu ul.detailSubnav li a.selected').show() ? or even just $('a.selected').show() or you can set it in css a.selected { display: block; } dennis. Alexandre Plennevaux wrote: hello ! i have a menu which structure for each item is: (1) ul li div.linkSubMenu ul.detailSubnavlia except for the selected menu, which is: (2) ul li div.linkSubMenu ul.detailSubnavlia.selected on load, all div.linkSubMenu are hidden (via css: display:none) i would like that the selected one (2) be shown. I don't know how to target it via jquery, can you help me out? thank you! alex Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte Lakensestraat/Rue de Laeken 104 B-1000 Brussel-Bruxelles-Brussels Belgie-Belgique-Belgium Tel:+32(0)2.219.65.55 Fax:+32(0)2.426.69.86 Mobile:+32(0)476.23.21.42 http://www.lab-au.com blocked::http://www.lab-au.com/http://www.mediaruimte.be blocked::http://www.mediaruimte.be/ blocked::http://www.mediaruimte.be/_ _ The information in this e-mail is intended only for the addressee named above. If you are not that addressee, please note that any disclosure, distribution or copying of this e-mail is prohibited. Because e-mail can be electronically altered, the integrity of this communication cannot be guaranteed. __ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date: 27/03/2007 16:38 -- -- ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date: 27/03/2007 16:38 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selector question
in fact i just found a way: $(div.linkSubMenu ul li a.selected).parent().parent().parent().show(); is that the correct way? It seems a bit slow on rendering it. _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alexandre Plennevaux Sent: mercredi 28 mars 2007 21:31 To: 'jQuery Discussion' Subject: [jQuery] Selector question hello ! i have a menu which structure for each item is: (1) ul li div.linkSubMenu ul.detailSubnavlia except for the selected menu, which is: (2) ul li div.linkSubMenu ul.detailSubnavlia.selected on load, all div.linkSubMenu are hidden (via css: display:none) i would like that the selected one (2) be shown. I don't know how to target it via jquery, can you help me out? thank you! alex Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte Lakensestraat/Rue de Laeken 104 B-1000 Brussel-Bruxelles-Brussels Belgie-Belgique-Belgium Tel:+32(0)2.219.65.55 Fax:+32(0)2.426.69.86 Mobile:+32(0)476.23.21.42 HYPERLINK blocked::http://www.lab-au.com/http://www.lab-au.com HYPERLINK blocked::http://www.mediaruimte.be/http://www.mediaruimte.be HYPERLINK blocked::http://www.mediaruimte.be/__ The information in this e-mail is intended only for the addressee named above. If you are not that addressee, please note that any disclosure, distribution or copying of this e-mail is prohibited. Because e-mail can be electronically altered, the integrity of this communication cannot be guaranteed. __ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date: 27/03/2007 16:38 -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date: 27/03/2007 16:38 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selector question
You might also be able to reduce this a bit, depending on your markup: $('a.selected').parents('div.linkSubMenu').show(); It seems a shame to traverse all the way down that set of nodes, only to have to traverse back up. --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com On Mar 28, 2007, at 5:06 PM, Alexandre Plennevaux wrote: in fact i just found a way: $(div.linkSubMenu ul li a.selected).parent().parent().parent ().show(); is that the correct way? It seems a bit slow on rendering it. From: [EMAIL PROTECTED] [mailto:discuss- [EMAIL PROTECTED] On Behalf Of Alexandre Plennevaux Sent: mercredi 28 mars 2007 21:31 To: 'jQuery Discussion' Subject: [jQuery] Selector question hello ! i have a menu which structure for each item is: (1) ul li div.linkSubMenu ul.detailSubnavlia except for the selected menu, which is: (2) ul li div.linkSubMenu ul.detailSubnavlia.selected on load, all div.linkSubMenu are hidden (via css: display:none) i would like that the selected one (2) be shown. I don't know how to target it via jquery, can you help me out? thank you! alex Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte Lakensestraat/Rue de Laeken 104 B-1000 Brussel-Bruxelles-Brussels Belgie-Belgique-Belgium Tel:+32(0)2.219.65.55 Fax:+32(0)2.426.69.86 Mobile:+32(0)476.23.21.42 http://www.lab-au.com http://www.mediaruimte.be __ The information in this e-mail is intended only for the addressee named above. If you are not that addressee, please note that any disclosure, distribution or copying of this e-mail is prohibited. Because e-mail can be electronically altered, the integrity of this communication cannot be guaranteed. __ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date: 27/03/2007 16:38 -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date: 27/03/2007 16:38 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selector question
Karl Swedberg schrieb: You might also be able to reduce this a bit, depending on your markup: $('a.selected').parents('div.linkSubMenu').show(); It seems a shame to traverse all the way down that set of nodes, only to have to traverse back up. What about some XPath magic: $(//div.linkSubMenu[ul/li/a.selected]) At least its in the documentation, but I've not used it so far. http://docs.jquery.com/DOM/Traversing/Selectors#XPath_Selectors Look for Nodelist. -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] Selector question
it works! thanks a lot! _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonathan Sharp Sent: mercredi 28 mars 2007 20:55 To: [EMAIL PROTECTED]; jQuery Discussion Subject: Re: [jQuery] Selector question Try $('a.selected').parents().show(); as you need to show the parent elements, not the link. Cheers, -js On 3/28/07, Alexandre Plennevaux HYPERLINK mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: hello ! i have a menu which structure for each item is: (1) ul li div.linkSubMenu ul.detailSubnav lia except for the selected menu, which is: (2) ul li div.linkSubMenu ul.detailSubnavlia.selected on load, all div.linkSubMenu are hidden (via css: display:none) i would like that the selected one (2) be shown. I don't know how to target it via jquery, can you help me out? thank you! alex Alexandre Plennevaux - LAb[au] asbl.vzw / MediaRuimte Lakensestraat /Rue de Laeken 104 B-1000 Brussel-Bruxelles-Brussels Belgie -Belgique-Belgium Tel:+32(0)2.219.65.55 Fax:+32(0)2.426.69.86 Mobile:+32(0)476.23.21.42 http://www.lab-au.com http://www.mediaruimte.be __ The information in this e-mail is intended only for the addressee named above. If you are not that addressee, please note that any disclosure, distribution or copying of this e-mail is prohibited. Because e-mail can be electronically altered, the integrity of this communication cannot be guaranteed. __ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date: 27/03/2007 16:38 ___ jQuery mailing list HYPERLINK mailto:discuss@jquery.comdiscuss@jquery.com HYPERLINK http://jquery.com/discuss/; \nhttp://jquery.com/discuss/ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.448 / Base de données virus: 268.18.20/736 - Date: 27/03/2007 16:38 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] selector question
Karl Swedberg schrieb: On Feb 4, 2007, at 8:47 PM, Ⓙⓐⓚⓔ wrote: the great thing about dt and dd, is that they come in pairs! Well, not always. There can be multiple dd elements for each dt. Well, the other way round is also possible. Multiple dts with one dd. -- Klaus ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] selector question
On 05/02/2007, at 12:37 PM, Alexandre Plennevaux wrote: hello, say i have a definition list: dttitle /dt dd this content blabla/dd dtanother title /dt dd another content blabla/dd i would like to have an event triggered on each dt that modifies its following dd, and only that one. i tried a few , but cannot get it to work correctly; it's either all of them or an erratic move. the closest i got is: jQuery(function($) { $(dt).click( function() { $(~ dd,this).slideToggle(); }); }); can you tip me in the right direction? Thanks alex Hi Alex, how about this? jQuery(function($) { $(dt).click( function() { $(this).next(dd).slideToggle(); }); }); Untested. Joel Birch. ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] selector question
the great thing about dt and dd, is that they come in pairs! $(dt).click( function() { $(this).next('dd').slideToggle(); }); aught to do it... On 2/4/07, Alexandre Plennevaux [EMAIL PROTECTED] wrote: hello, say i have a definition list: dttitle /dt dd this content blabla/dd dtanother title /dt dd another content blabla/dd i would like to have an event triggered on each dt that modifies its following dd, and only that one. i tried a few , but cannot get it to work correctly; it's either all of them or an erratic move. the closest i got is: jQuery(function($) { $(dt).click( function() { $(~ dd,this).slideToggle(); }); }); can you tip me in the right direction? Thanks alex -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.441 / Base de données virus: 268.17.24/668 - Date: 4/02/2007 1:30 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] selector question
On Feb 4, 2007, at 8:47 PM, Ⓙⓐⓚⓔ wrote: the great thing about dt and dd, is that they come in pairs! Well, not always. There can be multiple dd elements for each dt. If you run into a situation in which you need to select possibly more than one dd until the next dt, you can use John Resig's nextUntil () plugin: $.fn.nextUntil = function(expr) { var match = []; // We need to figure out which elements to push onto the array this.each(function(){ // Traverse through the sibling nodes for( var i = this.nextSibling; i; i = i.nextSibling ) { // Make sure that we're only dealing with elements if ( i.nodeType != 1 ) continue; // If we find a match then we need to stop if ( jQuery.filter( expr, [i] ).r.length ) break; // Otherwise, add it on to the stack match.push( i ); } }); return this.pushStack( match, arguments ); }; Cheers, --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com $(dt).click( function() { $(this).next('dd').slideToggle(); }); aught to do it... On 2/4/07, Alexandre Plennevaux [EMAIL PROTECTED] wrote: hello, say i have a definition list: dttitle /dt dd this content blabla/dd dtanother title /dt dd another content blabla/dd i would like to have an event triggered on each dt that modifies its following dd, and only that one. i tried a few , but cannot get it to work correctly; it's either all of them or an erratic move. the closest i got is: jQuery(function($) { $(dt).click( function() { $(~ dd,this).slideToggle(); }); }); can you tip me in the right direction? Thanks alex -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.441 / Base de données virus: 268.17.24/668 - Date: 4/02/2007 1:30 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] selector question
thanks a lot Karl, that is helpful to know, although in this very case, it's one dd per dt. But indeed, it's perfectly valid to use several dd for one dt, as a word can have multiple definitions. _ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Karl Swedberg Sent: lundi 5 février 2007 4:52 To: jQuery Discussion. Subject: Re: [jQuery] selector question On Feb 4, 2007, at 8:47 PM, Ⓙⓐⓚⓔ wrote: the great thing about dt and dd, is that they come in pairs! Well, not always. There can be multiple dd elements for each dt. If you run into a situation in which you need to select possibly more than one dd until the next dt, you can use John Resig's nextUntil() plugin: $.fn.nextUntil = function(expr) { var match = []; // We need to figure out which elements to push onto the array this.each(function(){ // Traverse through the sibling nodes for( var i = this.nextSibling; i; i = i.nextSibling ) { // Make sure that we're only dealing with elements if ( i.nodeType != 1 ) continue; // If we find a match then we need to stop if ( jQuery.filter( expr, [i] ).r.length ) break; // Otherwise, add it on to the stack match.push( i ); } }); return this.pushStack( match, arguments ); }; Cheers, --Karl _ Karl Swedberg www.englishrules.com www.learningjquery.com $(dt).click( function() { $(this).next('dd').slideToggle(); }); aught to do it... On 2/4/07, Alexandre Plennevaux HYPERLINK mailto:[EMAIL PROTECTED][EMAIL PROTECTED] wrote: hello, say i have a definition list: dttitle /dt dd this content blabla/dd dtanother title /dt dd another content blabla/dd i would like to have an event triggered on each dt that modifies its following dd, and only that one. i tried a few , but cannot get it to work correctly; it's either all of them or an erratic move. the closest i got is: jQuery(function($) { $(dt).click( function() { $(~ dd,this).slideToggle(); }); }); can you tip me in the right direction? Thanks alex -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.441 / Base de données virus: 268.17.24/668 - Date: 4/02/2007 1:30 ___ jQuery mailing list HYPERLINK mailto:discuss@jquery.comdiscuss@jquery.com HYPERLINK http://jquery.com/discuss/http://jquery.com/discuss/ -- Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ ___ jQuery mailing list HYPERLINK mailto:discuss@jquery.comdiscuss@jquery.com HYPERLINK http://jquery.com/discuss/http://jquery.com/discuss/ -- Ce message Envoi est certifié sans virus connu. Analyse effectuée par AVG. Version: 7.5.441 / Base de données virus: 268.17.25/669 - Date: 4/02/2007 21:58 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/