This is what I am trying to do. First I get time in microseconds. Then I want to create a div (with the id x+microseconds) inside a div called container. And finally I want to add a image to the programmatically created div and fade in the div (and image). I have tried all sorts of things but I can not get my code to work. What am I doing wrong?
This is my code:
var img = document.createElement('img');
filename = "images/"+filename;
img.src = filename;
img.alt = "My alt text";
var now = new Date().getTime() / 1000;
now = "#x"+now;
jQuery("#container").append("<div {id:now} />");
$(now).hide();
document.getElementById(now).appendChild(img);
$(now).fadeIn(1000);