Inserting Nodes

Along with wanting to delete nodes other than at the end of the document, you’re likely to want to add nodes somewhere other than the end. With Scripts 11.7 (the HTML) and 11.8, you’ll be able to choose where you want your new nodes to appear. In Figure 11.6, you can see how the new node gets inserted.

Figure 11.6. To insert a paragraph, click the Insert before node radio button, select the desired paragraph you want for the insertion point (top), enter your text, and then click Submit (bottom).

Script 11.7. Another radio button and some script changes allow a third option—inserting text before another paragraph.
<!DOCTYPE ...

Get JavaScript and Ajax for the Web: Visual QuickStart Guide, Seventh Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.