I have two buttons Start and Next. I want that, initially the Start button is in the enabled state, and the Next button is in the disabled state. After the user clicks on the Start button, a function will run, and when the function is finished, the Next button will switch to the enabled state. I used the following code:
<button id="start" onclick="myfunction1" >Start</button>
<button id="next" onclick="myfunction2" disabled="disabled">Next</button>
<script>
function myfunction1(){
google.script.run.openUrl();
document.getElementById("start").disabled = true;
document.getElementById("next").disabled = false;
}
</script>
When I click on the Start button, the function myfunction1()
runs, and at the same time the Start button changes to the disabled state and the Next button changes to the enabled state. However, after the myfunction()
function completes, the Start button returns to the enabled state and the Next button returns to the disabled state.
I don't know how to solve it. I really need help. Thanks.