Makes the element either a child or parent of another element.
Syntax
object.applyElement(apply, where)Parameters
- apply [in]
-
Type: IHTMLElement
An object that becomes the child or parent of the current element. - where [in, optional]
-
Type: String
A String that specifies one of the following values.
Return value
Type: IHTMLElement
Returns a reference to the applied element.Standards information
There are no standards that apply here.
Remarks
This method is accessible at run time. If elements are removed at run time before the closing tag is parsed, areas of the document might not render.
If you call the applyElement method on an element that was created with the createElement method, but not yet added to the document tree, the element will lose the contents of its innerHTML property.
Examples
This example uses the applyElement method to apply the i element to an unordered list.
<!DOCTYPE html>
<html >
<head>
<title>Apply Element example</title>
</head>
<body>
<script type="text/javascript">
function fnApply() {
var oNewNode = document.createElement("i");
document.getElementById("oList").applyElement(oNewNode);
}
</script>
<ul id = oList>
<li>List item 1</li>
<li>List item 2</li>
<li>List item 3</li>
<li>List item 4</li>
</ul>
<input
type="button"
value="Apply Element"
onclick="fnApply()"
>
</body>
</html>
See also
- a
- abbr
- address
- area
- article
- aside
- b
- base
- 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
- getAdjacentText
- insertAdjacentElement
- replaceAdjacentText
- Conceptual
- About the W3C Document Object Model
Build date: 11/28/2012