On Jul 10, 4:50 am, "Sean Catchpole" <[EMAIL PROTECTED]> wrote:
> I believe that learning jquery returns an array like object is more
> useful than creating a .exists() function.

It seems to me that the most common reason for testing if an element
exists is to use it later, so why not:

  var element;
  if ( (element=$('#someID')[0]) ) {
    /* element exists */
  } else {
    /* damn... */
  }

Another idea is that if the seletor doesn't select any elements,
return null (as does getElementById() in that case):

  if ($('#someID')) {
    // something matched the selector
  }

but that may not be backward compatible.  Of what use is an empty
jQuery object?


--
Rob

Reply via email to