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 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

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

              
                <!-- create a form with input variables -->
<form id="form" class="additional-cookie"><!--action="google.com" method="post"> -->
    <h2>AutoFillForm Cookie</h2>
    <div class="form-rows">
        <label for="firstname">First Name:- </label>
        <input autoComplete="first-name" name="first-name" type="text" placeholder="First Name*" value="" data-sfv-minlength="3" data-sfv-required="yes">
    </div>
    <div class="form-rows">
        <label for="lastname">Last Name:- </label>
        <input autoComplete="last-name" name="last-name" type="text" placeholder="Last Name*" value="" data-sfv-minlength="3" data-sfv-required="yes">
    </div>
    <div class="form-rows">
        <label for="mail">Email:- </label>
        <input autoComplete="email" name="email" type="text" value="" placeholder="Email*" data-sfv-required="yes">
    </div>
    <div class="form-rows">
        <label for="company">Company:- </label>
        <input autoComplete="company-name" name="company-name" type="text" value="" placeholder="Company Name*" data-sfv-minlength="5" data-sfv-required="yes">
    </div>
    <div class="form-rows">
        <label for="phonenumber">Phone Number:- </label>
        <input autoComplete="phone" data-sfv-required="yes" name="phone" value="" type="text" placeholder="Phone">
    </div>
    <label for="country">Country:- </label>
    <select autoComplete="country-name" name="dropdown" data-sfv-required="yes">
        <option autoComplete="country-name" selectedvalue="SelectCoutry">Select Country</option>
        <option autoComplete="country-name" value="India">India</option>
        <option autoComplete="country-name" value="USA">USA</option>
    </select>
    <input type="submit" value="Submit">
</form>
              
            
!

CSS

              
                #form {
  background-color: #58a9fd;
  width: 600px;
  margin: 0 auto;
}
#form h2 {
  text-align: center;
  font-size: 28px;
}
#form label {
 width: 50%;
 color: #33352f;
 display: inline-block;
 text-align: right;
}
#form label.mail {
  padding-left: 10px;
}
#form input {
 margin: 10px 0 10px 0;
}
#form input.error {
   color: #FF0000;
  font-size: 20px;
}
#form .val_error {
   color: #ff0000;
}
              
            
!

JS

              
                // import latest jquery (2.x)

// import jquery validation plugin from
// https://github.com/Position2/jQuery-Simple-Form-Validation

//import js cookie plugin
//https://github.com/js-cookie/js-cookie

$(document).ready(function() { 
   var form = $("#form");
  //to retrive the values from stored cookie
    if (form.hasClass("additional-cookie")) {
        var formData = Cookies.getJSON('fujitsu_formdata');
        if (typeof(formData) != "undefined") {          
            form.find('input[name="first-name"]').val(formData.f_name);
            form.find('input[name="last-name"]').val(formData.l_name);
            form.find('input[name="email"]').val(formData.e_mail);
            form.find('input[name="company-name"]').val(formData.company_name);
            form.find('input[name="phone"]').val(formData.phone);
            form.find('select[name="dropdown"]').val(formData.Select);
        }
    }
    form.simpleValidation({
	    	"errorMsgClass" : "val_error",
	      "errorMsgTag" : "span",
        "beforeSubmit": function(form) {
          //for setting the values
        	if (form.hasClass("additional-cookie")) {  
            var fname = form.find('input[name="first-name"]').val();
            var lname = form.find('input[name="last-name"]').val();
            var email = form.find('input[name="email"]').val();
            var companyname = form.find('input[name="company-name"]').val();
            var phone = form.find('input[name="phone"]').val();
            var select = form.find('select[name="dropdown"]').val();
            Cookies.set('fujitsu_formdata', {
                "f_name": fname,
                "l_name": lname,
                "e_mail": email,
                "company_name": companyname,
                "phone": phone,
                "Select": select
            });
          }
        }
    });
});
              
            
!
999px

Console