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

              
                <form class="demo-form" id="create-profile">
  <div class="form-section">
    <div class="form-group has-feedback">
      <div class="input-group">
        <span class="input-group-addon"><i class="fa fa-user-o" aria-hidden="true"></i></span>
        <input type="text" class="form-control has-feedback-right" placeholder="First Name" name="firstname" id="firstname" required="required">
      </div>
      <span aria-hidden="true" class="glyphicon form-control-feedback right"> </span>
    </div>
	
    <div class="form-group has-feedback">
      <div class="input-group">        
        <span class="input-group-addon"></span>
        <input type="text" class="form-control has-feedback-right" placeholder="Last Name" name="lastname" id="lastname" required="required">
      </div>
      <span aria-hidden="true" class="glyphicon form-control-feedback right"> </span>
    </div>	
  </div> 

  
  <div class="form-section">
    <div class="form-group has-feedback">
      <div class="input-group">        
		<span class="input-group-addon">@</span>
        <input type="email" class="form-control has-feedback-right" placeholder="Email" name="email" id="email" required="required">
      </div>
      <span aria-hidden="true" class="glyphicon form-control-feedback right"> </span>
    </div>
  </div>

  <div class="form-section">
    <div class="form-group has-feedback">
      <div class="input-group">        
		<span class="input-group-addon"><i class="fa fa-phone" aria-hidden="true"></i>
</span>
        <input type="tel" class="form-control has-feedback-right" placeholder="Phone Number" name="tel" id="tel" required="required">
      </div>
      <span aria-hidden="true" class="glyphicon form-control-feedback right"> </span>
    </div>
  </div>

  <div class="form-navigation">
    <button type="button" class="previous btn btn-info pull-left">&lt; Previous</button>
    <button type="button" class="next btn btn-info pull-right">Next &gt;</button>
    <input class="btn btn-default pull-right" type="submit">
    <span class="clearfix"></span>
  </div>

</form>
              
            
!

CSS

              
                .form-section {
  padding-left: 15px;
  border-left: 2px solid #FF851B;
  display: none;
}
.form-section.current {
  display: inherit;
}
.btn-info, .btn-default {
  margin-top: 10px;
}
html.codepen body {
  margin: 1em;
}

              
            
!

JS

              
                $(function() {
  var parsleyOptions = {
    successClass: "has-success",
    errorClass: "has-error",    
    errorsMessagesDisabled: true,
    classHandler: function(_el) {
      return _el.$element.closest(".form-group");
    },
   
  };
  $("#create-profile").parsley(parsleyOptions);

  window.Parsley.on("form:error", function(formInstance) {
    $(".popover").hide();
    $(":focus").parsley().validate();
  });

  window.Parsley.on("field:validated", function(fieldInstance) {
    var element = fieldInstance.$element;

    var feedback = element
      .closest(".form-group")
      .find(".form-control-feedback");
    
    $(".popover").hide();

    if (fieldInstance.isValid()) {
      feedback.removeClass("glyphicon-remove");
      feedback.addClass("glyphicon-ok");
    } else {
      feedback.removeClass("glyphicon-ok");
      feedback.addClass("glyphicon-remove");      

      element
        .popover({
          trigger: "manual",
          container: "body",
          placement: "bottom",
          content: function() {
            return fieldInstance.getErrorsMessages().join(";");
          }
        })
        .popover("show");
    }
  });

  var $sections = $(".form-section");

  function navigateTo(index) {
    // Mark the current section with the class 'current'
    $sections.removeClass("current").eq(index).addClass("current");
    // Show only the navigation buttons that make sense for the current section:
    $(".form-navigation .previous").toggle(index > 0);
    var atTheEnd = index >= $sections.length - 1;
    $(".form-navigation .next").toggle(!atTheEnd);
    $(".form-navigation [type=submit]").toggle(atTheEnd);
  }

  function curIndex() {
    // Return the current index by looking at which section has the class 'current'
    return $sections.index($sections.filter(".current"));
  }

  // Previous button is easy, just go back
  $(".form-navigation .previous").click(function() {
	$(".popover").hide(); 	
    navigateTo(curIndex() - 1);
  });

  // Next button goes forward iff current block validates
  $(".form-navigation .next").click(function() {  
    if ($(".demo-form").parsley().validate({ group: "block-" + curIndex() })) {
		$(".popover").hide(); 	
		navigateTo(curIndex() + 1);
	 }
  });

  // Prepare sections by setting the `data-parsley-group` attribute to 'block-0', 'block-1', etc.
  $sections.each(function(index, section) {
    $(section).find(":input").attr("data-parsley-group", "block-" + index);
  });
  navigateTo(0); // Start at the beginning
});

              
            
!
999px

Console