/

HTML / CSS / JavaScript Tutorial

JavaScript Properties and Methods for HTML Attributes

[this page | pdf | back links]

HTML attributes (Attr objects) within the JavaScript DOM support the following generic properties:

 

Properties:

 

Property

Description

More

isId

Returns true if attribute is of type ID, otherwise returns false

Here

name

Returns name of attribute

Here

value

Sets/returns value of attribute

Here

specified

Returns true if attribute has been specified, otherwise returns false

Here

 

Further comments:

 

In the W3C DOM Core, the Attr object inherits all properties and methods from the Node object. However, many of these properties and methods aren’t meaningful for HTML attributes. Also, in DOM 4 this inheritance will no longer apply, so it is desirable not to use node object properties and methods on Attr objects.

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript DOM (and BOM)


Desktop view | Switch to Mobile