[Answer]-Displaying images in Django via JavaScript


The html() method doesn’t accept two parameters. You are attempting to create an element and initialize some of its properties. Try creating it properly and appending it:

$("#images").empty().append($("<img>", {src: thumb}));

DEMO: http://jsfiddle.net/tGbG6/

The <div id='images'></div> element’s id should be unique, so you can use the selector $("#images") (this is true for the other selectors you have)…otherwise jQuery does some extra unnecessary work.



Leave a comment