I have a page below which is using jquery to append some html. It simply append an input tag in the 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 i = 0;
function test(){
var totalQuantity = '<input type="number" name="order' + i + '.totalQuantity" />';
$(".test").append(totalQuantity);
i++;
}
</script>
</head>
<body>
<div class="test"></div>
<input type="button" onclick="test()" value="Add" />
</body>
</html>
When I run this on server in tomcat using spring, on inspect element the javascript becomes something like:
var totalQuantity = '<input type="number" name="order'+i+ '.totalQuantity" />';
All the ( ' ) characters replaced by code (#&39).
what is the problem actually? Why it is not showing character ( ' ) but rather showing its html code?
Is this a problem with using spring because when I separately(not in a container or spring framework) open this html file, it works fine.