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
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
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
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
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
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();
6 matches
Mail list logo