Java Reference
In-Depth Information
Interestingly, there is no
insertAfter
method, so you should ensure that you have ac-
cess to the correct elements to place an element exactly where you want it.
Remove Elements from a Page
An element can be removed from a page using the
removeChild()
method. This meth-
od is called on the parent node and has a single parameter, which is the node to be removed.
It returns a reference to the removed node. For example, if we wanted to remove the
swim
paragraph we would use the following code:
swim = sports.removeChild(swim);
<< <p class="swim">
As you can see in
Figure 6.8
, it's been removed.