HTML:
<form name="myForm" onsubmit="return validateForm();" method="post" >
<input type="text" id="website" name="website" class="form-control" placeholder=" Website Link" >
<button value="Save" name="register" class="btn btn btn-primary btn-block " type="submit" >Register</button>
</form>
JavaScript:
function validateForm(){
var valdiationWebsite = document.forms["myForm"]["website"].value;
if (valdiationWebsite == ""){
alert("Please Enter Website Link ");
return false;
}
}
It will show an alert when field is blank.
But, if want to know is, entered text in the input field is valid website url or simple text, then what can i do?
How can i validate the entered text?
Please help me!