Skip to content
Arthur Guiot edited this page Jul 7, 2017 · 1 revision

How it works?

Want to check if an element is another element? The simple solution to do this is to use the $.is() function. You simply have to give it 2 elements and it will returns you true or false.

How to use it?

Just give it 2 elements like $.is($.select(".myFirstElement"), $.select("#mySecondElement")).

So, let's take a look at an example. Imagine we have an element with a class and an idea and we want to check if we are selecting the same element.

HTML:

<div class="randomClass" id="randomId">Hello World 🌎!</div>

JS:

if ($.is($.select(".randomClass"),$.select("#randomId"))) {
    console.log("'.randomClass' and '#randomId' is the same element")
else {
    console.log("'.randomClass' and '#randomId' is not the same element")
}

⚠️ Questions?

Don't hesitate to ask your questions ⁉️ in the issue part 😁

Clone this wiki locally