FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 405   



Demo

Code

<html>

<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    <script>
        $(document).ready(function() {
            $("#btn").click(function() {
                console.log("iam in function");
                var number = $("#num").val();
                console.log("selcet number" + number);

                //var output = "";
                if (number == 1) {
                    output = "Sunday"
                } else if (number == 2) {
                    output = "Monday"
                } else if (number == 3) {
                    output = "Tuesday"
                } else if (number == 4) {
                    output = "Wednesday"
                } else if (number == 5) {
                    output = "Thursday"
                } else if (number == 6) {
                    output = "Friday"
                } else if (number == 7) {
                    output = "Saturday"
                } else {
                    output = "Not a weekday"
                }
                $("#result").html(output);
            });
        });
    </script>
</head>

<body>
    Enter a number:
    <input type="text" name="value" id="num"></input>
    <button id="btn"> Submit </button>
    <p id="result"> </p>
</body>

</html>



On By


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News