Determines whether an attribute with the specified name exists.
![]() |
Syntax
object.hasAttribute(name, pfHasAttribute)Parameters
- name [in]
-
Type: String
String that specifies the name of the attribute.
Return value
Type: Boolean
falseThe specified attribute does not exist.
trueThe specified attribute exists.
Standards information
Remarks
The hasAttribute method tests for the existence of an attribute specified by name. The hasAttributes method, on the other hand, determines whether the element has any attributes at all.
See also
- a
- abbr
- address
- area
- article
- aside
- b
- base
- bdo
- blockQuote
- body
- br
- button
- caption
- cite
- code
- col
- colGroup
- comment
- custom
- dd
- del
- div
- dl
- dt
- em
- embed
- fieldSet
- figcaption
- figure
- footer
- form
- head
- header
- hgroup
- hn
- hr
- html
- i
- iframe
- img
- input type=button
- input type=checkbox
- input type=file
- input type=hidden
- input type=image
- input type=password
- input type=radio
- input type=reset
- input type=submit
- input type=text
- ins
- kbd
- label
- legend
- li
- link
- map
- mark
- nav
- object
- ol
- option
- p
- pre
- q
- rt
- ruby
- s
- samp
- script
- section
- select
- small
- span
- strong
- style
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- title
- tr
- u
- ul
- var
- Reference
- getAttribute
- hasAttributes
Build date: 11/28/2012
