Click to See Complete Forum and Search --> : inser variable into the tag


lontana
July 29th, 2009, 05:01 AM
Hi all,
I am new in Javascript world so this question might be for some very simple but still I could not find a solution for it by seraching the web.
I have a variable:
var myvar="mystring";
that I want to print together with a html tag:
("<span class=\"myclass\">"document.write(myvar)"</span>")
Could someone help me?
Thanks

PeejAvery
July 29th, 2009, 08:47 AM
document.write('<span class="myclass">' + myvar + '</span>');