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
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) ...
2 matches
Mail list logo