I have a table which is structured like a calendar, 1 table row with 31 table cells.
I am trying to show the child div of the TD clicked on so that its unique to that day.
At the moment if i click on the second TD it shows cell 1's div content, I need it to show its own child div content.
I have the popup working but I just need a hand figuring out how to show the unique day div content.
// When the user clicks on <div>, open the popup unique to that cell
function openPopup() {
var popup = document.getElementById("myPopup");
popup.classList.toggle("show");
}
<table>
<thead>
</thead>
<tbody>
<tr>
<td onclick="openPopup()">
<p class="day-number-red">1 </p>
<p class="sports-on-day">
Cricket <br> Tennis <br> Darts </p>
<div class="popup">
<span class="popuptext" id="myPopup">Example 1</span>
</div>
</td>
<td onclick="openPopup()">
<p class="day-number-red">2 </p>
<p class="sports-on-day">- </p>
<div class="popup">
<span class="popuptext" id="myPopup">Example 2</span>
</div>
</td>
</tr>
</tbody>
</table>