I’m trying to make this script for a forum, which allows the use of tags in posts. Unfortunately, we can’t use line breaks whenever we write these CSS styles because the form reads them as <br>‘s and it screws everything.
They appear like this:
<style type="text/css"><!-- <br>#herp { background: #fff; }<br> --></style>
If we stop the form from reading <br>‘s, it would affect the rest of the elements. So we’ve tried to remove them using this:
var style = document.getElementsByTagName("style"); for(x=1;x<style.length;x++) { style[x].innerHTML.replace(/\<br\>/gi,""); }
…to no avail.
To be honest, I’m not quite sure what kind of entities lie between these style tags. I don’t think they’re strings, nor are they comments. So the replace() doesn’t seem to work.
Any thoughts?
1 Answer