4
How to know if the browser supports certain methods, estates and events.
Checking whether an object querySelector
, querySelectorAll
, addEventListener
, classList
exists via Javascript.
I’ve been trying something with if .. else
a flow control structure based on a condition.
Example
// Criando o elemento para verificar
var elem = document.createElement('classList');
if(elem != "undefined"){
alert ('Existe sim.');
} else {
alert ('Não existe.');
}