if attribute javascript code example
Example 1: jquery if attribute
if ( $('html').attr('lang') == 'fr-FR' ) {
// do this
} else {
// do that
}
Example 2: how to check element has an attribute js
let result = element.hasAttribute(name);
if ( $('html').attr('lang') == 'fr-FR' ) {
// do this
} else {
// do that
}
let result = element.hasAttribute(name);