36/95

Get set and remove attributes

Get the attribute's value

// Get the `title` attribute of a link element
const title = link.getAttribute('title');

Set the attribute's value

// Set the width and height of an image
image.setAttribute('width', '100px');
image.setAttribute('height', '120px');

Remove the attribute

// Remove the `title` attribute
ele.removeAttribute('title');

Might be useful