• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 16. Dynamic HTML: Changing Web P... > The insertAdjacentHTML and insertAdj...

The insertAdjacentHTML and insertAdjacentText Methods

The Internet Explorer insertAdjacentHTML and insertAdjacentText methods (see “The insertAdjacentHTML and insertAdjacentText Methods” in Chapter 6, “Using Core HTML Methods and Events,” for their syntax) give you finer control over where the HTML you insert in pages goes than document.write provides.

The insertAdjacentHTML method enables you to insert HTML next to an element that exists already, and the insertAdjacentText method enables you to insert text (which will not be treated as HTML, but just as plain text). You can determine where the new text or HTML will go with respect to the already existing element by passing the constants "BeforeBegin", "AfterBegin", "BeforeEnd", or "AfterEnd" to insertAdjacentHTML and insertAdjacentText, as discussed in Chapter 6.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint