Checking textbox is empty or not- Using JavaScript validation statement we can check textbox is empty or not.
E.g.
Check Output:
E.g.
<html>
<head>
<title>Checking textbox is empty or not</title>
</head>
<body>
Check textbox is empty or not!
<form name="form1">
Enter text:<input type="text" name="txtempty">
<input type="button" onclick="check()" value="Check">
</form>
<script language="javascript">
function check()
{
if(document.form1.txtempty.value.length==0)
{
alert("Textbox is empty" + "\nIf you like this post then please \nshare it using share buttons \ngiven below")
}
else
{
alert("Textbox is not empty" + "\nIf you like this post then please \nshare it using share buttons \ngiven below")
}
}
</script>
</body>
</html>
Related Topics:
- JavaScript Introduction
- Variables in JavaScript
- JavaScript Function
- Accessing JavaScript Function
- Creating JavaScript interactive form
- Accessing form field value
- Creating interactive form login webpage
- Networking Fundamentals
- TCP/IP and Internet addressing
- Internet Working
- Internet Working Servers
- Concept and need for web publishing
- Web languages
- Javascript Control Structure
- Checking Text is Letter/s
- Checking Text is Number/s
- Checking Textbox is Empty or not
- Addition of two numbers
- Subtraction of two numbers
- Multiplication of two numbers
- Division of two numbers
- Form field validations
- Email validation