I can check if an element have a specific attribute with:
if ($('#A').attr('myattr') !== undefined) {
// attribute exists
} else {
// attribute does not exist
}
How can I check if an element have any attribute?
Thank you
If you want to see if the element has a particular attribute, just do this:
if ($('#something').is('[attribute]')) {
// ...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With