The easiest way to check as to whether or not your jQuery selector is returning a value is to remember that the selector is simply returning an array of jQuery objects. If no matching elements are found it simply returns an empty array.
Which of course then means that you can either check the length or size() of the returned value to ensure that it is greater than 0, indicating that your selector has successfully matched on your search request.
In other words:
if $(‘#selectMyElement’).length > 0 returns true, then you know you’ve got a hit!
Related Posts :
If for instance you have just used a jQuery selector to grab a whole lot of objects and now real ...
Four years have passed since the initial public release of the stellar jQuery library and in cel ...
mysql_query() is the powerful PHP function tasked with handling the execution of all SQL stateme ...
The question for today is how to bind a single function to multiple different elements (in other ...
To iterate though a web form's contents using jQuery is as easy as 123. First, make use of the $ ...






