I have some HTML content inside a JavaScript variable:
var string="<tr> <td> data 1 </td> <td> data 2 </td> <td> data 3 </td></tr>";
I want to remove the white spaces between HTML tags only. The White space in column data must be remain same.
string.replace(/\n/g, "");
string.replace(/[\t ]+\</g, "<");
string.replace(/\>[\t ]+\</g, "><");
string.replace(/\>[\t ]+$/g, ">");
I tried the above code. But this is not worked. Some one please help me to solve this problem.
var string=" data 1 data 2 data 3 "so that it becomesvar string="data 1 data 2 data 3"<tr>and the last tag</tr>). And why? You have probably made a wrong analysis of some problem.