Form-Validation This is the complete example code of how to validate a HTML form in terms of data using JavaScript. JavaScript code is below in the file under the <script> tag Required CSS is in the tag under <style>