cara memeriksa elemen memiliki atribut js
let result = element.hasAttribute(name);
Clever Corncrake
let result = element.hasAttribute(name);
var attr = $(this).attr('name');
// For some browsers, `attr` is undefined; for others,
// `attr` is false. Check for both.
if (typeof attr !== typeof undefined && attr !== false) {
// ...
}
if ( $('html').attr('lang') == 'fr-FR' ) {
// do this
} else {
// do that
}