Link to home
Start Free TrialLog in
Avatar of skij
skijFlag for Canada

asked on

HTML/JavaScript/jQuery: Should Entities be Used for Dynamically Added Content?

I understand that when coding HTML, this:
<a href="Link?a=1&amp;b=2&amp;c=3">Link</a>
is better than this:
<a href="Link?a=1&b=2&c=3">Link</a>

What about when the content is added dynamically, for example using AJAX?
<!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>Demo</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {

 $('div').append('<a href="Link?a=1&amp;b=2&amp;c=3">Link</a>')
 $('div').append('<a href="Link?a=1&b=2&c=3">Link</a>')

});
</script>
</head>
<body>
<div>

</div>
</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial