i got blocks like these:
<div class="listener" id="123">
<h1>Title</h1>Some text...
<div class="container"></div>
</div>
<br>
<div class="listener" id="456">
<h1>Title</h1>Some text...
<div class="container"></div>
</div>
CSS:
.listener{width:500px;background:red;border:1px solid black}
JavaScript:
document.getElementByClassName("listener").addEventListener("click", function()
{
// get the id of the DIV
// put content inside the class=container inside the DIV with innerHTML
});
What should happen?
After clicking in one of those boxes:
- call the function
- get the ID of the clicked DIV
- put some content inside the DIV (DIV with class=container)
Please NO solution with <a>
or jQuery.
Any idea? Thanks!
I have a Fiddle here: https://jsfiddle.net/wwp9jk8t/