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
- address
- area
- article
- aside
- b
- bdo
- blockQuote
- body
- br
- button
- caption
- cite
- code
- col
- colGroup
- 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
- map
- mark
- nav
- object
- ol
- optGroup
- option
- p
- pre
- q
- rt
- ruby
- s
- samp
- section
- select
- small
- span
- strong
- sub
- sup
- table
- tBody
- td
- textArea
- tFoot
- th
- tHead
- tr
- u
- ul
- var
- Reference
- innerText
- insertAdjacentHTML
- outerText
Build date: 11/28/2012