Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="check_container_div">
    <input type="checkbox"  value="val_1"  id="ch_box_1"  myattr="mt1" checked>       <br>
    <input type="checkbox"  value="val_2"  id="ch_box_2"> 2                           <br>
    <input type="checkbox"  value="val_3"  id="ch_box_3">                             <br>
    <input type="checkbox"  value="val_4"  id="ch_box_4" checked> 4                   <br>
    <input type="checkbox"  value="val_5"  id="ch_box_5" name="mycheckbox">           <br>
    <input type="checkbox"  value="val_6"  id="ch_box_6" checked> 6                    <br>
    <input type="checkbox"  value="val_7"  id="ch_box_7" name="mycheckbox2" checked>     <br>
    <input type="checkbox"  value="val_8"  id="ch_box_8"> 8
    <input type="radio"  value="val_9"  id="radio_9" name="r1"> 9
    <input type="radio"  value="val_10"  id="radio_10" name="r1"> 10      
</div>        <br>

<div id="result_1"></div>             

<div id="result_2"></div>             

<div id="result_3"></div>             

<div id="result_4"></div>             

<div id="result_5"></div>             

<div id="result_6"></div>             

<div id="result_7"></div>

<div id="result_8"></div>             

<div id="result_10"></div>   <br>



<pre> 
Apart from this pen, See this :

This is a Good Article & Detailed Article, for checkbox jQuery, 9March16 :

http://stackoverflow.com/questions/2204250/check-if-checkbox-is-checked-with-jquery
http://jsfiddle.net/subodhghulaxe/LvQXE/12/

</pre>
              
            
!

CSS

              
                body {  width: 95%; margin-left: 14%; font: 18px Calibri;  }
input[type="checkbox"]{ width: 19px; height: 19px; vertical-align: -2px;  }
div { border: 1px solid gainsboro; margin: 15px 3px; width: 80%; 
  padding: 3px 0 0 9px; color: #333;  }

#result_1 { background: url(https://sahni4you.weebly.com/uploads/6/5/6/5/65659497/result_1__109x31__font_14calibri_mspaint_made.png) no-repeat right bottom;
  background-size: 17%;
  border: 1px solid gainsboro; margin: 5px 0; }
#result_2 { background: url(https://sahni4you.weebly.com/uploads/6/5/6/5/65659497/result_2__109x31__font_14calibri_mspaint_made.png) no-repeat right bottom;
  background-size: 17%;
  border: 1px solid gainsboro; margin: 5px 0; }
#result_3 { background: url(https://sahni4you.weebly.com/uploads/6/5/6/5/65659497/result_3__109x31__font_14calibri_mspaint_made__bg_is_rgb245__color_rgb60.png) no-repeat right bottom;
  background-size: 17%; 
  border: 1px solid gainsboro; margin: 5px 0; }
              
            
!

JS

              
                // All Methods below work, use whichever.   Also See : http://jsfiddle.net/sahni4you/0e45hrnb/
                                                     //http://jsfiddle.net/sahni4you/ouuhzzjz/

if ( $('#ch_box_1').is(':checked') ) {
     //Do something
    $('#result_1').html( "its checked r1" );
}

    var checko = $('#ch_box_2').is(':checked');
if (!checko ) {
    //Do something
    $('#result_2').html( "its unchecked r2" );
}

if ( !($('#ch_box_2').is(':checked')) ) {}

// Make the 3rd one checked
$('#ch_box_3').attr ( "checked" , true );   //.attr ( "checked" , "checked" );  gives same res

// Make the 4th one un-check
$('#ch_box_4').prop( 'checked', false );

// Javascript     https://www.w3schools.com/jsref/prop_radio_checked.asp
var ch_box_1 = document.getElementById("ch_box_5").checked = true;

if (ch_box_7.checked){                              //ref -- http://jsfiddle.net/sahni4you/0e45hrnb/
    $('#result_3').html( "its checked r3" );
}

if (!ch_box_8.checked){   //jQuery                           //ref -- http://jsfiddle.net/sahni4you/0e45hrnb/
    $('#result_4').html( "its unchecked r4" );
}

//prop Method for jQuery
if ( $('#ch_box_3').prop('checked') === true  ){}
if ( $('#ch_box_3').prop('checked') === false ){}

/* try this on console to get true or false
$('#ch_box_3').prop('checked');               //Returns true  on console
Javascript equivalent of above:
document.getElementById("ch_box_3").checked;  //Returns true  on console
*/


if ( $('#ch_box_3').prop('checked') === true  ){ $('#result_6').html( "its checked -- #ch_box_3" )  }
// $('#result_7') shows nothing.
if ( $('#ch_box_3').prop('checked') === false  ){ $('#result_7').html( "its checked -- #ch_box_3" )  }


//javascript
            var chkbox_8 = document.getElementById("ch_box_8");
if (!chkbox_8.checked){ $('#result_5').html( "its unchecked 5" ); }

//to check\uncheck a checkbox -- jQuery
//Use the new .prop() function as:                https://api.jquery.com/prop
                                                //http://stackoverflow.com/questions/17420534/check-uncheck-checkbox-using-jquery#
//$('#ch_box_3').prop('checked', true);  // Checks it
//$('#ch_box_3').prop('checked', false); // Unchecks it
//I have not used these here, as you will get to know their functionality
//live. So, use these on Codepen--console, these will check\uncheck a checkbox.
              
            
!
999px

Console