I'm trying to set the src attribute of an image to a URL that I also generate in JS. The URL contains several parameters chained with a "&", but when getting the element's outer HTML as string value, all the "&" are replaced by "& ;, making the URL useless. Why is this happening? Do I have to replace all the occurencies to fix it?
var img = $("<img>");
img.attr("src","/test?param1=1¶m2=2");
console.log(img[0].outerHTML); //printing <img src="/test?param1=1&param2=2">
getting the src attribute from that object shows the original string so I believe the value is encoded when accessing outerHTML.