satheesh kumar

satheesh kumar

  • NA
  • 3
  • 8.4k

Empty Text Box Validation Not Working

Apr 12 2016 11:02 PM
OnClientClick="return Validate()"
 
 
 
function Validate()
{
console.log("kkkk");
alert("pppp");
var pgng = document.getElementById("ContentPlaceHolder1_txtUsername").value.trim();
alert(pgng=='');
console.log(pgng);
if (document.getElementById("ContentPlaceHolder1_txtUsername").value.trim() == '') {
alert('The textbox should not be empty...');
document.getElementById("ContentPlaceHolder1_txtUsername").focus();
return false;
}
return false;
}
 

Answers (2)