Suppose I have the HTML code as below
<table width="600" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff">
<tr>
<td><img src="/images/pho_01.jpg" width="600" height="63" border="none" style="border: 0px;" alt="photo" /></td>
<td></td>
<td></td>
</tr>
</table>
The HTML code is not readable, I want to convert to something likes
<table width="600" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff">
<tr>
<td><img src="/images/pho_01.jpg" width="600" height="63" border="none" style="border: 0px;" alt="photo" /></td>
<td></td>
<td></td>
</tr>
</table>
I have ever used the $.trim(), but not works, could someone please suggest a way to
1. remove space(but don’t remove the space between attribute likes table width="600"…)
2. remove empty line
Thanks
Assuming your html is stored in a javascript string, you’ll have to split it up into multiple lines and use trim on each line.
e.g.