[jQuery] Re: Element defined or not

2007-07-10 Thread Matt Stith
Try if ($(selector).length0){ //... } On 7/10/07, Sebastián V. Würtz [EMAIL PROTECTED] wrote: Wich is the best way to know if a element for example a div is defined? like in php if ( empty($test) ) or if ( isset($test) ) thx

[jQuery] Re: Element defined or not

2007-07-10 Thread Sean Catchpole
On 7/10/07, Sebastián V. Würtz [EMAIL PROTECTED] wrote: Wich is the best way to know if a element for example a div is defined? We get this question a lot. jQuery returns the DOM in an array like fashion. This is standard: if($(div).length) ... or sometimes: var div = $(div)[0]; if(div) ...