jquery-attrs

v1.0.0
Select attributes from jquery collections.
jquery plugin attributes attrs DOM

$.fn.attrs()

Retrieves all the attributes with their associated values as object.

Example

<div id="elem" data-one="hello" data-two="world" something="else"></div>
$("#elem").attrs()
// -> { 'data-one': "hello", 'data-two': "world", 'something': "else" }

$("#elem").attrs(/^data\-/)
// -> { 'data-one': "hello", 'data-two': "world" }
npm i jquery-attrs

Metadata

  • MIT
  • Whatever
  • Julian Fleischer
  • released 4/8/2015

Downloads

Maintainers