How to check if an element DOM exists

Be careful when you wish if an element DOM exists. If you use:

This method doesn’t work because jQuery will return an [Object object] even if the element doesn’t exist. We may use a couple of methods to be sure that an element exists:

How to get jQuery version

How to fire an event