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

              
                <script src="jquery.js"></script>
<script src="parsley.min.js"></script>

<div class="container example">
  <p>I det här exemplet används <a href="http://parsleyjs.org">parsley.js</a> för validering och återkoppling.</p>
  
  <h1>Skapa användarkonto</h1>
  
     <form id="demo-form" role="form" data-parsley-validate>
    
          <div class="form-group">
            <label for="input-name" class="label-required">Namn</label>
          <input type="text" class="form-control" id="input-name" placeholder="" required data-parsley-required-message="Fyll i namn" data-parsley-trigger="focusout"
                 minlength="4">
       </div>
         
       <div class="form-group">
         <label for="input-email" class="label-required">E-postadress</label>
            <input type="email" class="form-control" id="input-email" placeholder="" data-parsley-required-message="Fyll i en giltig e-postadress" data-parsley-trigger="focusout" required>
       </div>
         
       <div class="form-group">
           <label for="input-password" class="label-required">Lösenord</label>
           <input type="password" data-minlength="8" class="form-control" id="input-password" placeholder="" data-parsley-trigger="focusout" required data-parsley-required-message="Fyll i ett lösenord"  minlength="8">
       </div>
         
       <div class="form-group">
         <label for="input-password" class="label-required">Upprepa lösenordet</label>
         <input type="password" class="form-control" id="input-password-confirm" data-parsley-equalto="#input-password" data-parsley-required-message="Upprepa det lösenord du fyllt i" data-parsley-trigger="focusout" required>
       </div>
         
        <div class="form-group">
          <p id="select-account"class="label label-required">Typ av användarkonto</p>
          <div class="radio-group" role="radiogroup" aria-describedby="select-account">
              <input id="employee" type="radio" name="type-of-user" data-parsley-required-message="Välj typ av konto" data-parsley-trigger="focusout" required>
            <label for="employee">
              Anställd
            </label>
            <br>
            <input id="student" type="radio" name="type-of-user">
            <label for="student">
              Student
            </label>
          </div>
        </div>

        <div class="form-group">
          <button id="demo-submit-form" type="submit" class="button">Skapa användarkonto</button>
        </div>
  </form>
</div>
              
            
!

CSS

              
                .form-group {
  margin-bottom: 1em;
}

.label {
    display: inline-block;
    margin-bottom: .5rem;
}

.label-required::after {
  content: ' *';
  color: #B94A48;
}

/* Parsley */
.parsley-errors-list { 
  /* use .form-errors-list */
    color: #B94A48;
    list-style: none;
    padding: 0;
}

.parsley-success {
  /* use .form-input-success */
  background-color: #DFF0D8;
  border-color: #D6E9C6;
}

.parsley-error {
  /* use .form-input-error */
  background-color: #F2DEDE;
  border-color: #EED3D7;
}

/* Only for this example */
.example {
  padding: 1em;
}
              
            
!

JS

              
                $(function () {
  $('#demo-form').parsley();
});

// Validation errors messages for Parsley
// Load this after Parsley
Parsley.addMessages('sv', {
  defaultMessage: "Ogiltigt värde.",
  type: {
    email:        "Ange en giltig e-postadress.",
    url:          "Ange en giltig URL.",
    number:       "Ange ett giltigt nummer.",
    integer:      "Ange ett heltal.",
    digits:       "Ange endast siffror.",
    alphanum:     "Ange endast bokstäver och siffror."
  },
  notblank:       "Värdet får inte vara tomt",
  required:       "Måste fyllas i",
  pattern:        "Värdet är ej giltigt",
  min:            "Värdet måste vara större än eller lika med %s",
  max:            "Värdet måste vara mindre än eller lika med %s",
  range:          "Värdet måste vara mellan %s och %s",
  minlength:      "Värdet måste vara minst %s tecken",
  maxlength:      "Värdet får maximalt innehålla %s tecken",
  length:         "Värdet måste vara mellan %s och %s tecken",
  mincheck:       "Minst %s val måste göras",
  maxcheck:       "Maximalt %s val får göras",
  check:          "Mellan %s och %s val måste göras",
  equalto:        "Värdena måste vara lika"
});

Parsley.setLocale('sv');

              
            
!
999px

Console