Since it appears that you're working with the DOM you might want to think about using HTML fragments rather than strings. Here is one article on the subject: http://ejohn.org/blog/dom-documentfragments/ For your example, try using something like $("<div />").css("display","inline-block").html("first Name"); Another related question on using fragments vs. strings: https://stackoverflow.com/questions/2217409/jquery-best-practice-for-creating-complex-html-fragments