The remove
method removes the given HTML/XML element. This method is provided by the Mojo::DOM
module, which is an HTML/XML DOM parser with CSS selectors.
$dom->at('html element')->remove
This method will remove the given node and return the root
or the parent
.
Let’s look at an example of this:
use 5.010;use Mojo::DOM;# Parse the htmlmy $dom = Mojo::DOM->new('<div>Inside div <p id="a">Inside paragraph </p></div>');# remove node psay $dom->at('p')->remove;
Mojo::DOM
module.$dom
scalar.p
using the remove
method and print the returned parent or root element.