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

              
                <!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<title>Vue.js Form</title>
	</head>
	<body>
		<div id="app" class="container-fluid">
      <h1>Vue.js Form</h1>
        
        <div class="form-container" v-if="!formSuccess">
          <div class="form-row">
            <div class="form-group col-6">
              <input type="text" class="form-control" placeholder="First name" v-model="firstName">
            </div>
            <div class="form-group col-6">
              <input type="text" class="form-control" placeholder="Last name" v-model="lastName">
            </div>
            <div class="form-group col-12">
              <input type="text" class="form-control" placeholder="address" v-model="address">
            </div>
            <div class="form-group col-md-6">
              <input type="text" class="form-control" placeholder="City" v-model="city">
            </div>
            <div class="form-group col-md-4">
              <select id="state" class="form-control" v-model="state">
                <option selected>State</option>
                <option>State 1</option>
                <option>State 2</option>
                <option>State 3</option>
                <option>State 4</option>
              </select>
            </div>
            <div class="form-group col-md-2">
              <input type="text" class="form-control" placeholder="ZIP" v-model="zip">
            </div>
            <div class="form-group col-12">
              <div class="form-check">
                <input class="form-check-input" type="checkbox" id="subscribe_nl" v-model="subscribe_nl">
                <label class="form-check-label" for="subscribe_nl">Subscribe Newsletter</label>
              </div>
            </div>
            <button type="submit" class="btn btn-primary" v-on:click="submitForm">Send</button>
          </div>
        <div class="alert alert-danger col-12 mt-3" v-if="formError">{{formError}}</div>
      </div>
      
      <div class="alert alert-success col-12 mt-3" v-if="formSuccess">Form successfully submitted! ;)</div>
		</div>
	</body>
</html>

              
            
!

CSS

              
                
              
            
!

JS

              
                var app = new Vue({
  el: "#app",
  data: {
    firstName: '',
    lastName: '',
    address: '',
    city: '',
    state: '',
    zip: '',
    subscribe_nl: false,
    formError: '',
    formSuccess: ''
  },
  methods: {
    submitForm() { 
      let errors = false;
      
      if(this.firstName === '') errors = true;
      if(this.lastName === '') errors = true;
      if(this.address === '') errors = true;
      if(this.city === '') errors = true;
      if(this.state === '') errors = true;
      if(this.zip === '') errors = true;
  
      if(errors) {
        this.formError = 'Please correct the mistakes!';
        return false;
      }
      
      // your sendmail function or anything goes here
      
      alert('Form submitted');
      this.formSuccess = true;
    },
  }
});
              
            
!
999px

Console