1. String html = "<!DOCTYPE html><html><head><title></title></head><body><p>hello there</p></body></html>"; 2. Document d = Jsoup.parse(html); 3. System.out.println(d); 4. System.out.println("************************************************"); 5. d.getElementsByTag("p").remove(); 6. System.out.println(d);
while you get with Elements, you get some problems, you can do this action on the Document d object. which will work for sure.
Nomanjaved
source share