Pen Settings



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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <br />
<form id="registration" method="post" action="#">
  First Name: <input id="firstname" type="text" value="" /> <br />
  Last Name : <input id="lastname" type="text" value="" /> <br />
  Hobby     : 
    <input type="checkbox" id="hobbyCricket" name="hobby" value="Cricket"> Cricket </input>
    <input type="checkbox" id="hobbyBasketball" name="hobby" value="Basketball" checked> Basketball </input>
    <input type="checkbox" id="hobbyHockey" name="hobby" value="Hockey" checked> Hockey </input>
    <input type="checkbox" id="hobbyBadminton" name="hobby" value="Badminton"> Badminton </input>
    <input type="checkbox" id="hobbyFootball" name="hobby" value="Football" checked> Football </input> <br />

    <input type="radio" name="gender" value="male" checked> Male </input>
    <input type="radio" name="gender" value="female"> Female </input>     <br />

    Select your highest level of Education. 
    <select id="education" name="education" type="select">
      <option value="0"></option>
      <option value="1">Elementary</option>
      <option value="2">High School</option>
      <option value="3">Bachelor</option>
      <option value="4" selected>Master</option>
      <option value="5">PhD</option>

    <br /> <br />
  <input id="submitForm" type="submit" class="btn btn-primary" value="Submit"/>
  <input id="resetForm" type="button" value="Reset" class="btn btn-info"/>
  <input id="clearOutput" type="button" value="Clear Output" style="display: none;" class="btn btn-danger"/>

<!-- Output printing area -->
<p id="output"></p>

<h2> <a href="" target="_blank">Written by </a>





                // Reset form
$("#resetForm").on("click", function(){
  // Select all elements starting with id=hobby and uncheck it.
  $("[id^='hobby']").attr("checked", false);
  $("[name='gender']").prop("checked", false);
  //Clean output area
  $("#clearOutput").css("display", "none");

//Submit Form
$("#registration").on("submit", function(event){
  var firstName = $("#firstname").val();
  var lastName = $("#lastname").val();
  var selectedHobby = "";
    selectedHobby += $(this).val();
    selectedHobby += ", ";
  var selectedGender = $("[name='gender']:checked").val();
  var selectedEducation = $("#education option:selected").text();
  // Clear output area.
  //Start printing output
  $("#output").append("<b>Your Output</b> <br />");
  $("#output").append("Firstname : "+firstName+"<br />");
  $("#output").append("Lastname : "+lastName+"<br />");
  $("#output").append("Your Hobby : "+selectedHobby+"<br />");
  $("#output").append("Your Gender : "+selectedGender+"<br />");
  $("#output").append("Your Education : "+selectedEducation+"<br />");

  //Display Clear Output button
  $("#clearOutput").css("display", "inline");
  event.preventDefault(); // To prevent default behaviour of submit event.

//Clear output on click of #clearOutput
$("#clearOutput").on("click", function(){
  $("#clearOutput").css("display", "none");