javascript - Avoiding Unexpected Token illegal while string assignment -


i pretty new web development , trying achieve following

i have c# string has html tags (its cshtml page - asp.net webpages ):

var htmlstr="div style="text-align: center;"><i style="font-size: 10pt;"><b><u>some text&nbsp;</u></b></i></div><div style="text-align: center;"><i><b><u><br></u></b></i></div><div style="text-align: center;"><i><b><u><br></u></b></i></div><div style="font-weight: normal; text-align: center; font-style: normal;"><br></div>" ; 

then in javascript use follows :

 var jstr = '@htmlstr'; 

i following error

*"uncaught syntax error: unexpected token illegal"*

i assuming string not getting assigned properly. please me out here , let me know proper way of doing ???

thanks in advance!!!

i found solution escape function :

var jstr = escape('@htmlstr'); 

Comments