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

              
                <p>配送方法3を選択したら、「配送時間を選択」が非表示になるサンプルです。</p>

<label for="ship-type">配送方法を選択</label>
<select id="ship-type" class="ship-type">
  <option value="value1">配送方法1</option>
  <option value="value2">配送方法2</option>
  <option value="value3">配送方法3</option>
</select>

<!-- カレンダーマスターの配送時間選択メニュー -->
<div class="app-deliverydate app-deliverydate--time">
  <label for="delivery_time" class="delivery_time">配送時間を選択</label>
  <select id="delivery_time" name="attributes[delivery_time]" value="" style=""> 
    <option>指定なし</option> 
    <option>午前中</option>
    <option>12時頃-14時頃</option>
    <option>14時頃-16時頃</option>
  </select>
</div>

              
            
!

CSS

              
                /* サンプル上の見た目を整えるためだけのスタイル */
.ship-type {
  margin: 30px 0;
}
              
            
!

JS

              
                const selectMenu = document.getElementById("ship-type");
const timeOption = document.querySelector(".app-deliverydate--time");

selectMenu.addEventListener("change", function() {
  if(selectMenu.value === "value3") {
    timeOption.style.display = "none";
  } else {
    timeOption.style.display = "block";
  }
});
              
            
!
999px

Console