Nanobot: Polygonal Mascot
Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

has-attr

1.0.3 • Public • Published

has Attr

JQuery plugin which adds new simple functionality :

  • hasAttr - checks wheter attribute is present on given element(s)
  • hasData - checks wheter given data attribute is present on given element(s)

Usage

hasAttr

Arguments:
Name:string - name of the attribute

Returns:
True when attribute is present, otherwise false.

Example:

<p id="test" class="test">something</p>
$("#test").hasAttr("class")

returns true

hasData

Arguments:
Name:string - name of the data

Returns:
True when attribute is present, otherwise false.

Example:

<p id="test" data-test>something</p>
$("#test").hasData("test")

returns true

install

npm i has-attr

Downloadsweekly downloads

14

version

1.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability