Nodeschool Public Materials
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    attspublic

    atts

    DOM attributes JavaScript module for ender or standalone use

    npm install atts --save
    var atts = require("atts")

    API

    atts.attr(element, name, value?)

    • Get or set attributes.
    • @return string|undefined

    atts.atts(element, object?)

    • atts.atts(element) get object containing all attributes
    • atts.atts(element, object) set attributes via object
    • @return object

    atts.removeAttr(element, names)

    • Remove attributes.
    • @return undefined

    atts.toggleAttr(element, name, state?)

    • Toggle an attribute"s presence and return boolean state.
    • @return boolean

    atts.isAttr(element, name)

    • Is attribute name present on element?
    • @return boolean

    atts.supportAttr(element, name)

    • Test if element supports an attribute.
    • @return boolean

    atts.anyAttr(element, fn?, scope?)

    • Count or iterate element"s attributes.
    • @return number

    Chain methods

    These exist on atts.prototype and are designed for integration into jQuery-like libs but can also be used via atts.prototype[method].call. Methods are generally compatible with jQuery methods of the same name.

    • .attr(name, value?)
    • .atts(object?)
    • .removeAttr(ssv)
    • .toggleAttr(name, force?)

    install

    npm i atts

    Downloadsweekly downloads

    14

    version

    0.4.0

    license

    CC0-1.0

    repository

    githubgithub

    last publish

    collaborators

    • avatar