1.0.3 • Published 7 years ago

has-attr v1.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

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