html – how to make JavaScript wait for form validation

I am creating a html file to use only a div, but javascript is the one that makes the most work. I'm using this div to change the content of the page. Once I load a form in this div, I have to wait until the user's entry is validated. But instead, I find that it takes all the initial entries as those in progress and validates the empty entries. What is a good way to solve this problem?