//My suggestion will be to split the text by <br>: var lines = content.split("<br>"); //Now you can wrap each line in a <div>: var newContent = ""; for(var i=0,l=lines.length;i<l;i++){ newContent += "<div>"+lines[i]+"</div>"; }