So at Esper we made this tool to make our lives easier.
var s = ' <div> <span class="example">Welcome!</span> </div> ';
var s = '<div>' +' <span class="example">Welcome!</span>' +'</div>';
This required more edits than we wanted, but why not. Now something we often do is modify child nodes based one some conditions. We use jQuery to produce a dom node from a string, maybe as follows:
var view = $( '<div>' +' <span class="example" id="msg"></span>' +'</div>'; ); var text = isNewUser(user) ? "Welcome!" : "Hello!"; $("#msg").text(text);