Showing posts with label element exists. Show all posts
Showing posts with label element exists. Show all posts

10 January 2014

How do you check if an element exists or not in jQuery?

Using jQuery length property, we can ensure whether element exists or not.
                    $(document).ready(function()
                        {
                        if ($('#element').length > 0)
                        {
                         //Element exists
                        });
                        });