Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

insertAdjacentText method

Inserts the given text into the element at the specified location.

Syntax

object.insertAdjacentText(where, text)

Parameters

where [in]

Type: String

String that specifies where to insert the text, using one of the following values:

beforeBegin

Inserts the text immediately before the element.

afterBegin

Inserts the text after the start of the element but before all other content in the element.

beforeEnd

Inserts the text immediately before the end of the element but after all other content in the element.

afterEnd

Inserts the text immediately after the end of the element.

text [in]

Type: String

String that specifies the text to insert.

Return value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Standards information

There are no standards that apply here.

Remarks

The text inserted into the element is plain text

You cannot insert text while the document loads. Wait for the onload event to fire before attempting to call this method.

See also

a
abbr
acronym
address
applet
area
article
aside
b
bdo
big
blockQuote
body
br
button
caption
center
cite
code
col
colGroup
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
listing
map
mark
marquee
menu
nav
nextID
noBR
object
ol
optGroup
option
p
plainText
pre
q
rt
ruby
s
samp
section
select
small
span
strike
strong
sub
sup
table
tBody
td
textArea
tFoot
th
tHead
tr
tt
u
ul
var
xmp
Reference
innerText
insertAdjacentHTML
outerText

 

 

Show:
© 2014 Microsoft