Skip to navigation
Add new attribute with javascript
19.02.21
const button = document.querySelector('.service-section button') Endnote. Ok, now let’s create an attribute of the type id: const attribute = document.createAttribute('id') And give it a value (name): attribute.value = `js-button-run-function` Now attach your newly created attribute to your button element: button.setAttributeNode(attribute)
https://techstacker.com/how-to-create-add-attribute-html-javascript/
Reply
Anonymous
Information Epoch 1711694403
Data dominates.
Home
Notebook
Contact us