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

              
                <div>
  <input type="checkbox" id="radio_1" onclick="set_visibility();">ボタンのvisibilityを切り替えます
  <br />
  <input type="checkbox" id="radio_2" onclick="set_display();">ボタンのdisplayを切り替えます
  <br />
  <button id="btn_1" type="button">
    ボタン
  </button>
  <br /><br />
  <input id="txt_1" type="text" placeholder="入力時に下の文書のdisplayを切り替えます" style="width:300px;">
  <br />
  <p id="p_1">サンプル文章。サンプル文章。</p>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                function set_visibility() {
  if (document.getElementById('radio_1').checked){
    // btn_1を非表示
    document.getElementById('btn_1').style.visibility = 'hidden'
  }else{
    // btn_1を表示
    document.getElementById('btn_1').style.visibility = 'visible'
  }
}

function set_display() {
  if (document.getElementById('radio_2').checked){
    // btn_1を非表示
    document.getElementById('btn_1').style.display = 'none'
  }else{
    // btn_1を表示
    document.getElementById('btn_1').style.display = 'inline'
  }
}

window.addEventListener('DOMContentLoaded', function(){
  var txt_1 = document.getElementById("txt_1");
  txt_1.addEventListener("input",function(){
    if (0 < txt_1.value.length){
      document.getElementById('p_1').style.display = 'none'
    }else{
      document.getElementById('p_1').style.display = 'inline'
    }
  });
});
              
            
!
999px

Console