Convert HTML tag to lowercase

I am working on an intranet project for IE6 (I know ...), and I need to get some HTML code from the div.

I use $('#output').text($('#container').html());

But IE6 prints all the code in uppercase:

<TABLE border=1>
 <TR>
  <TD>Test Content</TD>
 </TR>
</TABLE>

How to convert HTML tags to lowercase using jQuery?

It would be useful to have a plugin that can recursively pass through the DOM tree.

+3
source share
2 answers

Try

$('#output').text($('#container').html().replace(/<\/?[A-Z]+.*?>/g, function (m) { return m.toLowerCase(); }));
+5
source

What if you use .html () instead of .text ()?

-2
source

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


All Articles