Conditional Statement as Hierarchy jQuery
Posted
by Jacob Lowe
on Stack Overflow
See other posts from Stack Overflow
or by Jacob Lowe
Published on 2010-04-02T02:12:47Z
Indexed on
2010/04/02
2:23 UTC
Read the original article
Hit count: 454
Is there a way to make jQuery use objects in a conditional statement as an object in a hierarchy. For Example, I want to validate that something exist then tell it to do something just using the this selector.
Like this
if ($(".tnImg").length) {
//i have to declare what object I am targeting here to get this to work
$(this).animate({
opacity: 0.5,
}, 200 );
}
Is there a way to get jQuery to do this? I guess theres not a huge benefit but i still am curious
© Stack Overflow or respective owner