jQuery .is()

The jQuery .is() function is different and useful. There similar .has() function is also worth a look.

When you step around a HTML document, you can lose track of your HTML elements. Your pages will vary in structure. You sometimes need to check the current element to ensure you arrived at the right place. .is() checks the current element.

The related .has() checks the contents of the current element to ensure the current element is the right element. Your use of .has() and .is() will depend on what information is available to check your location.