Required Field in Textbox in HTML using Java Script
<!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
<script language="javascript"
type="text/javascript">
function requiredvalidator(valueoftextbox) {
var TextBox1 = valueoftextbox.value;
var result = document.getElementById("lbresult");
if (TextBox1 == "")
{
result.style.display = "";
return false;
}
else {
result.style.display = "none";
}
return true;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="Text1" type="text" onblur="requiredvalidator(this);" name="TextBox1" />
<label id="lbresult"
style="display: none;">Required
Field </label>
</div>
</form>
</body>
</html>
Required Field in Textbox in HTML using Java Script
Reviewed by NEERAJ SRIVASTAVA
on
9:43:00 PM
Rating:
No comments: