We will develop a simple script to check user input in a text box. The input data should be one email address. So it must have two minimum chars present. One is @ and other one is presence of . ( dot ). To ensure this, we will use indexOf function. If both are present then the function will return true so the form will be submitted otherwise it will return false.