Write a jQuery code to disable the submit button until the visitor has clicked a check box.

Write a jQuery code to disable the submit button until the visitor has clicked a check box.

Write a jQuery code to disable the submit button until the visitor has clicked a check box. 

Answer :
File Name : jquery4.html

<html>
<head>
    <script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>

    <title>SP Creation</title>
</head>
<body>
    <div class="container">
        <div class="col">
            <form id="form">
               <div class="col">
                  Checkbox  <input type="checkbox" name="checkbox" id="check" class="form-group">
               </div>
                <button id="submit" disabled="disabled" type="submit" class="btn btn-primary">SUBMIT</button>
            </form>
        </div>
    </div>
    <script>
        $(document).ready(function(){
            $('#check').click(function() {
                if ($('#submit').is(':disabled')) {
                    $('#submit').removeAttr('disabled');
                } else {
                    $('#submit').attr('disabled', 'disabled');
                }
            });
        });
    </script>
</body>
</html>
Write a jQuery code to disable the submit button until the visitor has clicked a check box. Write a jQuery code to disable the submit button until the visitor has clicked a check box. Reviewed by technical_saurabh on April 29, 2021 Rating: 5

No comments:

Powered by Blogger.