title: Adding image and text links to the same html div container in JavaScript
body: <p>I have a div called &quot;films&quot; and I want to add an image and text that both link to the same webpage. When I do the following, only the text link works and the image link is disabled. When I remove the text link, then the image link works.</p>
  <pre><code> var img = document.createElement(&quot;img&quot;);
                  img.src = myImage.png;
                  img.onclick = function() {
                       window.location.href = &quot;https://www.imdb.com/title/tt0068646/&quot;;
                  };
                  document.getElementById(&quot;films&quot;).appendChild(img);
                  document.getElementById('films').innerHTML += &quot;&lt;br /&gt;&quot; + &quot;myText&quot;.link(&quot;https://www.imdb.com/title/tt0068646/&quot;) + &quot;&lt;br /&gt;&lt;br /&gt;&quot;;
  </code></pre>