The issue is the following: I want to modify a h1 (id="waiting") and then execute a function that takes several seconds to complete (solve).
function solveWrapper(table) {
document.getElementById("waiting").innerHTML = "Wait please, Nurikabe is being solved...";
alert("alert");
var currentState = new State(table);
solve(table, currentState);
}
With this code I get the alert before the solve function is called, but the h1 tag is modified only after that function execution is finished. Does anyone know how to fix this? This is the button that calls solveWrapper:
<button onclick="solveWrapper(grid);">Solve</button>
Here is the whole code: https://github.com/jackowski626/projects/blob/master/Nurikabe_SJ_Solver.html