Starr Duskk
asked on
Check if an element is defined
I have this code...
var portfolio_item = $$('.portfolio_item');
Following is a bunch of stuff manipulating items within this item, but if the item is not defined on the page, I want it to skip that stuff.
How can I do an if statement that makes sure this item is even on the page first?
var portfolio_item = $$('.portfolio_item');
Following is a bunch of stuff manipulating items within this item, but if the item is not defined on the page, I want it to skip that stuff.
How can I do an if statement that makes sure this item is even on the page first?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
great!
ASKER
Everything I was reading was saying to check the length...
http://www.kavoir.com/2009
if ($("#some").length)
http://jqueryfordesigners.
$('element').length == 0;
And that errored.
Thanks again! Yours works!