Removes an attribute from an object.
![]() |
Syntax
object.removeAttribute(strAttributeName, lFlags)Parameters
- strAttributeName [in]
-
Type: String
String that specifies an attribute name.
- lFlags [in, optional]
-
Type: Integer
Integer that specifies whether to use a case-sensitive search to locate the attribute. Can be one of the following values:
Return value
Type: Boolean
Boolean. Returns one of the following possible values:| Return value | Description |
|---|---|
|
The attribute was successfully removed. |
|
The attribute was not removed. |
Standards information
- Document Object Model (DOM) Level 2 HTML Specification, Section 1.6.5
Remarks
removeAttribute always returns S_OK as an HRESULT value. Check the pfSuccess parameter to determine if the attribute is successfully removed.
If your pages are displayed in a Windows Store app using JavaScript or a Windows Store app using JavaScript, be careful when spelling attribute names. If two or more attributes have the same name—differing only in capitalization—and lFlags is set to 0, this method removes only the last attribute to be created with this name. All other attributes of the same name are ignored.
The strAttributeName parameter requires the name of the desired content attribute and not the Document Object Model (DOM) attribute.
The strAttributeName parameter is not case sensitive. As a result, the lFlags parameter is no longer supported and should not be used.
The methods support event handlers. For example, the following code example defines an event handler to call a function called SomeFunction when the body of the page is loaded.
document.body.setAttribute('onload', 'SomeFunction()');
removeAttribute always returns S_OK as an HRESULT value. Check the pfSuccess parameter to determine if the attribute is successfully removed.
See also
- a
- address
- area
- b
- base
- blockQuote
- body
- br
- button
- caption
- cite
- code
- col
- colGroup
- comment
- custom
- dd
- div
- dl
- dt
- em
- embed
- fieldSet
- form
- head
- 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
- kbd
- label
- legend
- li
- link
- map
- meta
- object
- ol
- option
- p
- pre
- runtimeStyle
- s
- samp
- script
- select
- small
- span
- strong
- style
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- title
- tr
- u
- ul
- var
- Reference
- getAttribute
- setAttribute
Build date: 11/28/2012
