I want to replace all image tags with div tag. I am able to select all tags and I know that I have to use replaceWith. But I am unable to use it.
And if I use TextNode for replacing it with <div> </div> and it converts into &lt;div&gt; my div &lt;/div&gt;
I know &lt; and &gt; is for < and >
Please help me.
I guess you are replacing with element.replaceWith(new TextNode("<div></div>"),"");?
A Textnode is for text and escapes content - thats why you see the HTML entities. You need to replace with a tag, so do something like element.replaceWith(new Element(Tag.valueOf("div"), ""));.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With