How do you check if an element has an attribute JavaScript?

To check if an HTML element has a specific attribute, you can use the hasAttribute() method . This method returns true if the specified attribute exists, otherwise it returns false . The hasAttribute() method also works for the HTML5 data-* attributes.10 Ağu 2020

Sizin İçin Seçtik  What is get attribute in JavaScript?

Leave a Reply

Your email address will not be published. Required fields are marked *