Answer the question
In order to leave comments, you need to log in
How to stop js script execution?
Welcome all.
I need to write a js script that will read the user's nickname from cookies. If it is not there, then a modal form should appear in which the user will enter his nickname and which will be recorded in cookies. The problem is that js does not want to stop its execution so that the user can enter his nickname in the form and returns an empty value. How to stop the execution of a js script for a while until the user enters his nickname and clicks on the submit button? Or please indicate another way to solve this problem. Thanks in advance.
Answer the question
In order to leave comments, you need to log in
document.querySelector('input').addEventListener('change', function(e){
// Your code
}
Subscribe to the change event for the input field, this event will fire when the user stops typing and removes focus.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question