I'm using the following code to create an image element, load it, then append it to the article on load.
$('<img />')
.attr('src', 'image.png') //actually imageData[0].url
.load(function () {
$('article').append($(this));
alert('image added');
});
The alert is firing off ok, but the image doesn't appear, and when I inspect the element it has been added without the closing slash
<img src='image.png' >
Why is the browser removing the forward slash and how do I stop it?
UPDATE: Thanks to everyone who has pointed out that it's not the slash that's the problem (every day's a school day), so what could it be then? Here's the live example http://chris-armstrong.com/inspiration/?username=behoff
UPDATE 2: Ok so it appears I'm a moron for not testing this with other images, as the issue seems to be with the test image I was using (http://img.ffffound.com/static-data/assets/6/dc01f803819405bfe160459021cfe6cc57766f9b_m.jpg). Strange because it loads when you click on the URL... but anyway, thanks for all your help folks, I learned a few things!
image.pngin quotes..attr('src', 'image.png')and maybe you have to add a slash before it:.attr('src', '/image.png'). Check the path.articleis either anidor aclass.. isn't it ??articleelement.