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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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 Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

HTML

              
                  <div class="wrap">
    <div id="input-01">
      <p>焼き菓子</p>
      <div class="all-ck">
        <input type="checkbox" name="焼き菓子" value="全ての焼き菓子" id="ck-01-all">
        <label for="ck-01-all">全ての焼き菓子</label>
      </div>
      <ul class="ck-list">
        <li>
          <input type="checkbox" name="焼き菓子" value="クッキー" id="ck-01-01">
          <label for="ck-01-01">クッキー</label>
        </li>
        <li>
          <input type="checkbox" name="焼き菓子" value="パウンドケーキ" id="ck-01-02">
          <label for="ck-01-02">パウンドケーキ</label>
        </li>
        <li>
          <input type="checkbox" name="焼き菓子" value="マドレーヌ" id="ck-01-03">
          <label for="ck-01-03">マドレーヌ</label>
        </li>
      </ul>
    </div>
    <div id="input-02">
      <p>生菓子</p>
      <div class="all-ck">
        <input type="checkbox" name="生菓子" value="全ての生菓子" id="ck-02-all">
        <label for="ck-02-all">全ての生菓子</label>
      </div>
      <ul class="ck-list">
        <li>
          <input type="checkbox" name="生菓子" value="シュークリーム" id="ck-02-01">
          <label for="ck-02-01">シュークリーム</label>
        </li>
        <li>
          <input type="checkbox" name="生菓子" value="プリン" id="ck-02-02">
          <label for="ck-02-02">プリン</label>
        </li>
        <li>
          <input type="checkbox" name="生菓子" value="エクレア" id="ck-02-03">
          <label for="ck-02-03">エクレア</label>
        </li>
        <li>
          <input type="checkbox" name="生菓子" value="タルト" id="ck-02-04">
          <label for="ck-02-04">タルト</label>
        </li>
      </ul>
    </div>
  </div>
              
            
!

CSS

              
                .wrap{
  div{
    margi-bottom:30px;
  }
  p{
    padding:5px;
    background:#ddd;
  }
}
ul{
  margin:10px 0 0;
  padding:0;
  list-style-type:none;
}
              
            
!

JS

              
                  $('.all-ck input[type="checkbox"]').on('click', function() {
    var tgt= $(this).parent().next().find('input[type="checkbox"]');
    tgt.prop('checked', this.checked);
  });
  var ckBox = $('.ck-list input[type="checkbox"]');
  ckBox.on('click', function() {
    var ckThisCk = $(this).parent().parent().find('input[type="checkbox"]:checked');
    var ckThisDef = $(this).parent().parent().find('input[type="checkbox"]');
    var allCk = $(this).parent().parent().prev().find('input[type="checkbox"]');

    if ($(ckThisCk).length == $(ckThisDef).length){
      allCk.prop('checked', 'checked');
    }else{
      allCk.prop('checked', false);
    }
  });
              
            
!
999px

Console