[jQuery] Re: path and selectors

2007-04-27 Thread Dave Cardwell
Alexandre Plennevaux wrote: hello! i would like to know if there is a way to have jquery tell you what is the DOM path to an element. For example: $(this).click(function(){ alert($(this).getPath(); }); which would output html > body > div.col > ul.menu > li > a.selected Ask and ye

[jQuery] Re: path and selectors

2007-04-27 Thread Alexandre Plennevaux
Thank you my preciousss, it is very useful to debug !! -Original Message- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Dave Cardwell Sent: vendredi 27 avril 2007 13:13 To: jQuery (English) Subject: [jQuery] Re: path and selectors Alexandre Plennevaux

[jQuery] Re: path and selectors

2007-04-27 Thread Dave Cardwell
Alexandre Plennevaux wrote: Thank you my preciousss, it is very useful to debug !! No worries. If you're looking for JavaScript debugging Nirvana, take a looksie at the Firebug[1] extension for Firefox, and Firebug Lite[2] for the rest. [1] http://getfirebug.com/ [2] http://getfireb

[jQuery] Re: path and selectors

2007-04-27 Thread d . wachss
My quickie one-liner: $.fn.getPath = function(){ return $.map (this.add(this.parents()), function(el) { return el.tagName + (el.className ? '.'+el.className : ''); }).reverse().join(' > '); } On Apr 27, 6:59 am, "Alexandre Plennevaux" <[EMAIL PROTECTED]> wrote: > hello! > > i would like

[jQuery] Re: path and selectors

2007-04-27 Thread Ariel Jakobovits
ginal Message From: Dave Cardwell <[EMAIL PROTECTED]> To: jQuery (English) Sent: Friday, April 27, 2007 5:12:53 AM Subject: [jQuery] Re: path and selectors Alexandre Plennevaux wrote: > hello! > > i would like to know if there is a way to have jquery tell you what is

[jQuery] Re: path and selectors

2007-04-27 Thread d . wachss
Oooh..that's a much harder problem than the one originally presented. jQuery supports the :nth-child() selector; you want a string that uniquely selects 'this' . The following ought to work: (function ($){ function toString(el){ console.log (el); var ret = el.tagName.toLowerCase();