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.

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 id="app" class="p-8">
  <div class="mb-8">
    <select
      class="mr-2 p-2"
      id="select"
      v-model="selected"
      >
      <option
        disabled
        value=""
        >
        Please select one
      </option>

      <option>A</option>
      <option>B</option>
      <option>C</option>
    </select>
    
    <span>
      Selected: {{ selected }}
    </span>
  </div>

  <button 
    @click.prevent="changeValue"
    class="bg-transparent hover:bg-blue-500 text-blue-700 font-semibold hover:text-white py-2 px-4 border border-blue-500 hover:border-transparent rounded mr-2 mb-2"
  >
    Change value only
  </button>
  
  <button 
    @click.prevent="changeValueAndState"
    class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 border border-blue-500 rounded mr-2 mb-2"
  >
    Change value and state
  </button>
  
  <button 
    @click.prevent="resetValue"
    class="bg-transparent hover:bg-blue-500 text-blue-700 font-semibold hover:text-white py-2 px-4 border border-blue-500 hover:border-transparent rounded mr-2 mb-2"
  >
    Reset
  </button>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                new Vue({
  el: '#app',
  data() {
    return {
      selected: '',
      selectEl: ''
    }
  },
  methods: {
    resetValue() {
      this.selected = '';
      this.selectEl.value = ''
    },
    changeValue() {
      // This will only change the value of the select element. 
      // It will not update the data in 'selected'
      this.selectEl.value = 'A'
    },
    changeValueAndState() {
      // Changing the value of the select element and then
      // dispatching a 'change' event will update the data in 'selected'
      this.selectEl.value = 'C';
      this.selectEl.dispatchEvent(new Event('change'));
    }
  },
  mounted() {
    this.selectEl = document.getElementById('select');
  }
})

              
            
!
999px

Console