Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

check if a class exists javascript

const element = document.querySelector("#box");

element.classList.contains("active");
Comment

js class exists

var isMobileVersion = document.getElementsByClassName('snake--mobile');
if (isMobileVersion.length > 0) {
    // elements with class "snake--mobile" exist
}
Comment

class exists javascript


            
                
            
         const div = document.querySelector('.info');
div.classList.contains('secondary'); // trueCode language: JavaScript (javascript)
Comment

class exists javascript


            
                
            
         <div class="secondary info">Item</div>Code language: HTML, XML (xml)
Comment

PREVIOUS NEXT
Code Example
Javascript :: promise.race 
Javascript :: merge 2 json objects js 
Javascript :: default Electron icon is used reason=application icon is not set 
Javascript :: user input in js 
Javascript :: nodemailer, mailer, nodemailer npm 
Javascript :: javascript time 
Javascript :: plotly react 
Javascript :: reset page js 
Javascript :: js date in two weeks 
Javascript :: react native navigation change header title 
Javascript :: encrypt decrypt in vanilla javascript 
Javascript :: react webpack.config.js example 
Javascript :: select field in react native 
Javascript :: ISS proxy express 
Javascript :: js code sample 
Javascript :: react promises 
Javascript :: how to clear node modules folder from your computer 
Javascript :: run a local instance of Kibana on docker and connect to elasticsearch 
Javascript :: angular automatic typewriter animation 
Javascript :: filter duplicates javascript 
Javascript :: vue toggle boolean on click 
Javascript :: js loop through object keys 
Javascript :: how to change background image dynamically in react 
Javascript :: how to open print dialog box on button click 
Javascript :: remove element from array lodash 
Javascript :: how to set visibility in javascript of html title 
Javascript :: ping ip address using javascript 
Javascript :: mongodb unwind 
Javascript :: jquery cget lineheight in pixels 
Javascript :: github actions ssh 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =