Image from canvas is not displayed when the div is created dynamically

Estalsprats

New Member
Code:\[code\]$(document).ready(function(){ $("#AddButton").bind('click', function(event){ if(document.getElementById('optionselectthree').valuehttp://stackoverflow.com/questions/12818904/=='drawtab') { divshow(); clone(); event.stopPropagation(); } else if(...) { .. } }); });\[/code\]divshow() function:\[code\]function divshow(){var newImageBoxdiv = $(document.createElement('div')).attr("class",'demo');newImageBoxdiv.html('<img id="Imagedisplay" style="background-repeat: no-repeat; width:auto; width:100%; height:100%; cursor:move; position:absolute;" />');newImageBoxdiv.insertAfter("#imagedemo");$('.demo').show(); }\[/code\]clone() function:\[code\]function clone(){var c=document.getElementById("can");var d=c.toDataURL("image/png");document.getElementById("Imagedisplay").src=http://stackoverflow.com/questions/12818904/d;}\[/code\]Hi Guys, I am trying to draw an image on canvas and then display the drawn image (clone() function) on div which is called dynamically using divshow() function. Problem is that when i click on #AddButton, it displays the div without the image when the image src is correct.
 
Back
Top