I've implemented this function for form validation successfully, using the following code snippet:
$ function(document).ready(function(){.............});
Now I want to incorporate my own code within the same function block like so:
$ function(document).ready(function(){.............});
Any ideas on how I can achieve that? Thanks.
function myFunction () {
var a = document.getElementById("num").value;
var b = document.getElementById("num2").value;
var msg = "";
if(a==""){
msg+="Please Fill this field.\n";
num.className = "color";
}
if(b==""){
msg+="Please Fill this field.\n";
num2.className = "color";
}
if(msg=="") {
return true;
}
else {
document.getElementById("result").innerHTML="Please fill the user name";
document.getElementById("result2").innerHTML="Please Put your E-mail";
return false;
}
}