javascript - html showing code instead of character in jquery when running on server -
i have page below using jquery append html. append input tag in specified div
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <script src="../../jquery-1.10.2.min.js" type="text/javascript" xml:space="preserve"></script> <script type="text/javascript" xml:space="preserve"> var = 0; function test(){ var totalquantity = '<input type="number" name="order' + + '.totalquantity" />'; $(".test").append(totalquantity); i++; } </script> </head> <body> <div class="test"></div> <input type="button" onclick="test()" value="add" /> </body> </html> when run on server in tomcat using spring, on inspect element javascript becomes like:
var totalquantity = '<input type="number" name="order'+i+ '.totalquantity" />'; all ( ' ) characters replaced code (#&39).
what problem actually? why not showing character ( ' ) rather showing html code?
is problem using spring because when separately(not in container or spring framework) open html file, works fine.
while workaround, think it's proper way insert javascript html.
move javascript external file whatever pre-processing html won't touch javascript.
Comments
Post a Comment