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

Package Sidebar

Install

npm i has-attr

Weekly Downloads

3

Version

1.0.3

License

MIT

Last publish

Collaborators

  • shoter