How to tell if your browser supports certain methods , properties 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.');
}