cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation


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.

              <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="http://smoothprogramming.com/jquery/jquery-basics/" target="_blank">Written by SmoothProgramming.com </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");

Loading ..................