From the jQuery documentation:
You can use the length property of the jQuery collection returned by your selector.
Note: It isn't always necessary to test whether an element exists. The following code would show the item if it exists, and do nothing (no errors) if it did not:
You need to login to post a comment.