Export (0) Print
Expand All

applyElement method

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.

outside

Default. Specified element becomes a parent of the current element.

inside

Specified element becomes a child of the current element, but contains all the child elements of the current element.

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
acronym
address
applet
area
article
aside
b
base
baseFont
bgSound
big
blockQuote
body
br
button
caption
center
cite
code
col
colGroup
comment
custom
dd
del
dfn
dir
div
dl
dt
em
embed
fieldSet
figcaption
figure
font
footer
form
frame
frameSet
head
header
hgroup
hn
hr
html
i
iframe
img
input type=button
input type=checkbox
input type=email
input type=file
input type=hidden
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
ins
isIndex
kbd
label
legend
li
link
listing
map
mark
marquee
menu
nav
nextID
noBR
noFrames
noScript
object
ol
option
p
plainText
pre
q
rt
ruby
s
samp
script
section
select
small
span
strike
strong
style
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
title
tr
tt
u
ul
var
wbr
xml
xmp
Reference
getAdjacentText
insertAdjacentElement
replaceAdjacentText
Conceptual
About the W3C Document Object Model

 

 

Show:
© 2014 Microsoft