Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • is() method in jQuery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 399
    Comment on it

    is() method:

    It is used to filter html elements by checking with selectorElement. It returns true if there is minimum one match from the given selectorElement or some other argument provided.


    • selectorElement parameter is required and it contains that expression with which to filter.
    • It is optional parameter and it specifies a function to execute for group of selected elements.


    <!DOCTYPE html>
      <script src=""></script>
        .content{border:1px solid #333;padding:35px 12px;width:500px;margin-bottom:10px;background:#5AB0A6;margin: 0 auto;}
    	<div class="content">
            <h1 class="redeem-head">Redeem Portfolio</h1>
            <p class="subhead">check the checkbox to enable ok button</p>
            <p class="msg"><input type="checkbox" id="checkbox" name="prog"> <span>Please check the checkbox to redeem your account</span></p>
            <p><input type="button" value="OK" name="okbtn" id="okbtn" class="r-btn" disabled> 
            <input type="button" value="Cancel" name="cancelbtn" id="cancelbtn" class="r-btn"></p>
        <script type="text/javascript">
    		            if ($('#checkbox').is(':checked') ) {
    		                document.getElementById("okbtn").disabled = false;
    		                // $('#okbtn').hover.css('background-color','#f16a61');
    		            else {
    		                document.getElementById("okbtn").disabled = true;

    In the above example we have disabled ok button until the user will not check the checkbox and we are using is() method to check whether the checkbox is checked or not. When the user will check the checkbox ok button will get enabled.

    You can check the output of above example here:

 0 Comment(s)

Sign In

Sign up using

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: