Question and answer is powered by AnsPress.io
hi, i am the new learner of javascript….please tell me data validation code on java script.
Use this script in your form’s onsubmit() method.
function validateForm() { var x = document.forms["myForm"]["fname"].value; if (x == "") { alert("Name must be filled out"); return false; } }