table on the website
code of the website
hi im trying to run a script on the browser to allow me to select any of the values that is available once the page loads.
this is what i have so far
window.onload = function() {
// Get the table element by its ID
const table = document.getElementById('time_table');
// Get all cells within the table that have the specified class
const cells = table.querySelectorAll('.table-cell');
// Function to click the next cell (if available)
function clickNextCell(index) {
if (index < cells.length) {
cells[index].click();
}
}
// Click on the first cell
clickNextCell(0);
// Add an event listener to handle cell clicks
table.addEventListener('click', function(event) {
const clickedCell = event.target;
const currentIndex = Array.from(cells).indexOf(clickedCell);
clickNextCell(currentIndex + 1);
});
};
i want any of the cell that is clickable automatically once the page loads