How to Detect a HTML Element Has a Class

PHOTO EMBED

Saved by [deleted user] #html #javascript

var newForm = document.getElementById('new-form');

if ( newForm.getAttribute('class') === 'make-blue' ) {
        //  Do something
    }  
content_copyCOPY

This code will perform a function if the HTML element possesses a class of the name "make-blue".