JavaScript mendapatkan elemen oleh domlist kelas tidak ditentukan
// When querySelector doesn’t find a matching selector,
// the value of the variable will be : null .
// So use queryselector not multiple el selector like getElementByClassName
// To check if the DOM elements innerText is empty without errors use this:
var ismissingElement1 = document.getElementByClassName('myclass'); //with no dots
var ismissingElement = document.querySelector('.myclass'); // with dot
//CHECK FOR ANGULARJS POPULATED DOM (i.e. every 5 sec)
if( !ismissingElement1){ ismissingElement[0].length } //CHECK NOT POSSIBLE : undefined DOM list
//all this inside the brackets are not working: !== null or !==undefined
if (!ismissingElement){ alert ('this works! myclass element is present') }; //CHECK OK
Enrybi