I'm trying to remove white space between tags so that childNodes only contain those tags nodes not the white space nodes too. Here's my code :
<li>
<label for="firstName" class="mainLabel">First Name : </label>
<input type="text" name="firstName" id="firstName"/>
<span>This must be filled</span>
</li>
And here's the JS code :
var parentHTML = firstName.parentNode.innerHTML;
parentHTML = parentHTML.replace(/>\n</g,"><");
firstName.parentNode.innerHTML = parentHTML;
But when i alert parentHTML i get the same old string.