This is very odd. Here is a quick test function:
function test_function(){
code = '<img src="http://www.myimage.com/img.jpg" alt="image" />';
alert(code);
document.getElementById('test').innerHTML = code;
alert(document.getElementById('test').innerHTML);
}
Running the code above will show />
in the first alert, but the second alert doesn't, it shows just >
. So it looks like applying to .innerHTML
strips out the forward slash. Any ideas how to stop this from happening? I need the forward slash for validation.