Saturday, June 27, 2026

Java Script Test Box Blank

 <!DOCTYPE html>

<html>

<head>

    <title>Textbox Validation</title>

    <script>

        function validateTextBox() {

            var name = document.getElementById("txtName").value;


            if (name.trim() === "") {

                alert("Please enter your name.");

                return false;

            }


            alert("Submitted Successfully!");

            return true;

        }

    </script>

</head>

<body>


    <label>Name:</label>

    <input type="text" id="txtName">


    <br><br>


    <button onclick="validateTextBox()">Submit</button>


</body>

</html>

No comments:

Post a Comment

Data Transfer Java Script using Local Storage

  Page 1: index.html <!DOCTYPE html> <html> <head> <title> Page 1 </title> </head> <body> ...