1

I want an image and some text to appear in a div by using javascript but have had no luck so far. I tried to use the javascript innerHTML property to insert some text and an image but the javascript just breaks.

I tried making the function change the css of the image to appear when it needed to but the img tag got wiped from the div i was inserting the image into but kept the text.

but.onclick = function(){ 
modal.style.display = "block";
wrong.innerHTML = "test";
question1.innerHTML = "sometext.
<img src = "question1.jpg" style = "left:50%; right:50%; top:50%;"/>";}
Gabriele Petrioli
  • 191,379
  • 34
  • 261
  • 317
4pt_plyr
  • 51
  • 6

0 Answers0