It turns out that $() always return a object, which has a .length can be used to see if something has found.
So, I can do something like:
if ($('something').length > 0) {
alert('The DOM element has found!');
}
There is one more way to archive the same:
if ($('something').is('*') != '') {
alert('The DOM element has found!');
}
My passion has always been on software development, and I know it since I
wrote my first program on an Apple II. I worked on cellular wireless system
in the past (C/C++) and now focus on web application
(LAMP, PHP, MySQL, CakePHP, Symfony, jQuery, Google AppEngine/python).
![[Valid XHTML 1.0 Strict]](https://edmondhui.ddns.net/blog/skins/admun3/valid-xhtml.png)