This repository was archived by the owner on Jun 2, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
$.is()
Arthur Guiot edited this page Jul 7, 2017
·
1 revision
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.
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")
}Don't hesitate to ask your questions
- Home
- The Core Languages
- Getting Started: Installation
- The Basics (
$.var()+$.target()) - Developing for DisplayJS
-
$.select()- Text related
- If...else
$.xss()$.repeat()$.custom()$.live()$.load()$.on()$.onEvent()$.ready()- Scroll API
$.all()$.clone()$.is()$.valEmpty()$.remove()$.show()&$.hide()$.ajax()- Class Related
$.css()$.getStyle()- Fade effects
$.extend()$.dynamic()$.parent()- Elements-Nodes
$.component()$.time_ago()$.copy()$.then()$.sleep()$.getProp()