Search code examples
moovwebtritium

In Tritium, how do I remove text from a node?


I have some HTML content structured like this:

<div> 
   random text I want to remove
   <span>Important Text #1</span>
   more text I want to remove
   <span>Important Text #2</span>
</div>

How do I remove the text in this div while keeping the important content?


Solution

  • Use remove_text_nodes() to remove text.

    Please check this url for solution :- http://tritium.moovweb.com/c3387d70958324469350596c6ef334a7da4ac4f1