javascript - Appending a preloaded image to a div -


So, I did not think it would be complicated, but I could not understand myself.

I use JSON with & lt; Head & gt; Load images already in .

  // Images publish original = new image (698, 360); Original src = "imagenes_png / bosque_mapa.png"; ...  

Then I want to add preloaded images with a DIV tag name test, as well as JS.

 < // <  

This is in my div tag body

  & lt; Div id = "test" & gt; Testext & lt; / Div & gt;  

Although this does not work div still testext


For people with the same problem:

Keep

  Documents. GetElementById ('test'). AppendChild (original)  

here

  $ (document) .ready (function () {/ * code here * /}); $ (Document) .ready (function () {document.getElementById ('test'). AppendChild (original)});  

Why? Read the comments of David Thomas and follow the post link!

** Note: This solution requires jQuery which can be loaded like this:

  & lt ;! - LINK Zu JQUERY online - & gt; & Lt; Script src = "https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" & gt; & Lt; / Script & gt;  


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -