Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to check/uncheck checkbox with jQuery?

    • 0
    • 1
    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 303
    Comment on it

    Sometimes we need to check/unchecked checkbox based on some condition. We can do this easily by using "checked" attribute of a button.

    Example:

    <input type="checkbox" id="addressCheckBox" class="form-control"> 
    <label>I confirm this is my address</label>
    

    To unchecked the checkbox write the below line:

    $('#addressCheckBox').prop('checked', false);
    

    To check again after unchecked the checkbox:

    $('#addressCheckBox').prop('checked', true);
    

    Hope this will help you :)

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: