Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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

              
                <table>
  <thead>
    <tr><th>Checkbox
  <tbody>
    <tr>
      <td><input type="checkbox" class="chk" name="ago" value="a1">
    <tr>
      <td><input type="checkbox" class="chk" name="ago" value="a2">
    <tr>
      <td><input type="checkbox" class="chk" name="ago" value="a3">
    <tr>
      <td><input type="checkbox" class="chk" name="ago" value="a4">  
    <tr>
      <td><input type="checkbox" class="chk" name="ago" value="a5">
</table>
        
<button type='button' id='btn1' class="btn-square">map</button>
        
<button type='button' id='btn2' class="btn-square-shadow">each</button>
              
            
!

CSS

              
                table{
  width: 20%;
  border-collapse:separate;
  border-spacing: 0;
  margin:20px 100px;
}

table th:first-child{
  border-radius: 5px 0 0 0;
}

table th:last-child{
  border-radius: 0 5px 0 0;
  border-right: 1px solid #3c6690;
}

table th{
  text-align: center;
  color:white;
  background: linear-gradient(#829ebc,#225588);
  border-left: 1px solid #3c6690;
  border-top: 1px solid #3c6690;
  border-bottom: 1px solid #3c6690;
  box-shadow: 0px 1px 1px rgba(255,255,255,0.3) inset;
  width: 25%;
  padding: 10px 0;
}

table td{
  text-align: center;
  border-left: 1px solid #a8b7c5;
  border-bottom: 1px solid #a8b7c5;
  border-top:none;
  box-shadow: 0px -3px 5px 1px #eee inset;
  width: 25%;
  padding: 10px 0;
}

table td:last-child{
  border-right: 1px solid #a8b7c5;
}

table tr:last-child td:first-child {
  border-radius: 0 0 0 5px;
}

table tr:last-child td:last-child {
  border-radius: 0 0 5px 0;
}

.btn-square {
  margin: 0px 30px 0px 80px;
  display: inline-block;
  padding: 0.5em 1em;
  text-decoration: none;
  background: #668ad8;/*ボタン色*/
  color: #FFF;
  border-bottom: solid 4px #627295;
  border-radius: 3px;
}
.btn-square:active {
  /*ボタンを押したとき*/
  -webkit-transform: translateY(4px);
  transform: translateY(4px);/*下に動く*/
  border-bottom: none;/*線を消す*/
}

.btn-square-shadow {
  display: inline-block;
  padding: 0.5em 1em;
  text-decoration: none;
  background: #668ad8;/*ボタン色*/
  color: #FFF;
  border-bottom: solid 4px #627295;
  border-radius: 3px;
}
.btn-square-shadow:active {
  /*ボタンを押したとき*/
  -webkit-transform: translateY(4px);
  transform: translateY(4px);/*下に動く*/
  box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.2);/*影を小さく*/
  border-bottom: none;
}
              
            
!

JS

              
                $("#btn1").on("click", function(){
  // チェックされている値を配列に格納
  var chks = $('[class="chk"]:checked').map(function(){
      // 無効化する
      $(this).prop('disabled', true);
      // 値を返す
      return $(this).val();
  }).get();
  
  console.log(chks);
});

$("#btn2").on("click", function(){
  // 配列を宣言
  var arr = [];
  $('[class="chk"]:checked').each(function(){
      // 無効化する
      $(this).prop('disabled', true);
      // チェックされているの値を配列に格納
      arr.push($(this).val());
  });
  console.log(arr);
  
});
              
            
!
999px

Console