How to remove whitespace in html using Tritium

I use the Moovweb SDK , and I would like to remove the extra empty space from the beginning or end of any elements. Sometimes this manifests itself as or and I want to remove it, since it is a mess with my interval. How can I get around this?
Thanks.

+6
source share
2 answers

You can use regex to replace leading and trailing spaces with nothing.

Inside the tag, you can open the text area and use the replace(...) function to replace the start and end spaces:

 text() { replace(/^\s+|\s+$/, "") } 

Here is a working example in play.tritium.io:

http://play.tritium.io/648c6b2f72266b7b7db308e14dcb85f71707f4ee

+4
source
 text(" I'm an example ") text() { trim() } 

can also be used to remove spaces

0
source

Source: https://habr.com/ru/post/944255/


All Articles