Remove whitespace and line breaks between HTML elements using jQuery
- by mager
Using jQuery, I'd like to remove the whitespace and line breaks between HTML tags.
var widgetHTML = ' <div id="widget"> <h2>Widget</h2><p>Hi.</p> </div>';
Should be:
alert(widgetHTML); // <div id="widget"><h2>Widget</h2><p>Hi.</p></div>
I think the pattern I will need is:
>[\s]*<
Can this be accomplished without using regex?