Eugene2019-12-25 06:35:41
Eugene, 2019-12-25 06:35:41

After the condition is met, the innerhtml image is displayed. How to make it so that when you click on it, the previously hidden text + another picture drops out?

After checking the condition, a picture is displayed

if ((name[ss]=='abc')&(rusname[sd]=='абв')) {
document.getElementById('img1').innerHTML = "<img src=\"img/abc.png" +  "\" /> ";

<div id="img1">&nbsp;</div>
How to add an onclick to this image so that when you click on it, + one more image and another one and some text appear?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
ReaverJS, 2019-12-25

After creating a new element, attach an event listner to it. With jQuery the code is much easier.
And do you really need to create a new DOM element? Maybe just show a hidden element?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question