I want to replace each <li>
with #
and each </li>
with <br />
I think I need the Global repalce function for this, and not just string.replace()
, so ..
var s=obj1.innerHTML; s = s.replace(/<li>/g,"# "); s = s.replace(/</li>/g,"<br/>");
But it does not seem to work. Any mistake?
EDIT: I am going to use the code in a blogger, and therefore it needs to be parsed. Therefore you see "
instead of "
.
source share