call .setAttribute on a DOM node more easily
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
LICENSE.txt
README.md
package.json
setattributes.js

README.md

setAttributes

Set and delete multiple attributes in a DOM element.

This...

var el = document.querySelector('input')

el.setAttribute('type', 'password')
el.setAttribute('name', 'password-field')
el.removeAttribute('maxlength')

...is equivalent to this:

var setAttributes = require('setattributes')

var el = document.querySelector('input')

setAttributes(el, {
  type: 'password',
  name: 'password-field',
  maxlength: null
})