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
                        });
                        });

No comments:

Post a Comment