Answers for "check if an element has attribute jquery"

1

jquery check if attribute exists

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) {
    // ...
}
Posted by: Guest on March-14-2020
4

how to check element has an attribute js

let result = element.hasAttribute(name);
Posted by: Guest on July-28-2020
2

jquery if attribute

if ( $('html').attr('lang') == 'fr-FR' ) {
    // do this
} else {
    // do that
}
Posted by: Guest on January-19-2021

Code answers related to "check if an element has attribute jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language