Everything that I've seen says you have to check the length of the
element you are looking for.
So I think you want
pre
if($(this).parents('ul').length==0){
$(this).addClass(active);
}
/pre
If a parent UL was found, the length would be 0
This is correct.
I actually wrote a few jQuery extensions that handle this.
The code is:
$.fn.extend({
// checks to see if an element exists
// if no callback is supplied, returns
// a boolean value stating if the element
// exists, otherwise executes the callback
exists: function (callback) {
On Jan 14, 11:00 am, Matt Maxwell leftwithoutli...@gmail.com wrote:
[...]
var that = this; // scope
The value of the this keyword has nothing whatever to do with scope.
--
Rob
Thanks guys!! Got it working..
On Jan 13, 7:00 pm, Matt Maxwell leftwithoutli...@gmail.com wrote:
This is correct.
I actually wrote a few jQuery extensions that handle this.
The code is:
$.fn.extend({
// checks to see if an element exists
// if no callback is supplied, returns
// a
You're right. This was a small oversight on my end, though, it would have
been a little more helpful to the OP if you had provided an explanation with
your reply. :)
The reason I use var that = this; is not for scope but rather to ensure that
the proper object is being referenced inside the
5 matches
Mail list logo