cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

              <form action="#" id="form">
    <label for="name">Text Input:</label>
    <input type="text" name="name" id="name" value="" tabindex="1" />

    <h4>Radio Button Choice</h4>

    <label for="choice-1">Choice 1</label>
    <input type="radio" name="radio-choice-1" id="choice-1" tabindex="2" value="choice-1" />

    <label for="choice-2">Choice 2</label>
    <input type="radio" name="radio-choice-2" id="choice-2" tabindex="3" value="choice-2" />

    <label for="select-choice">Select Dropdown Choice:</label>
    <select name="select-choice" id="select-choice">
      <option value="Choice 1">Choice 1</option>
      <option value="Choice 2">Choice 2</option>
      <option value="Choice 3">Choice 3</option>
    <label for="textarea">Textarea:</label>
    <textarea cols="40" rows="8" name="textarea" id="textarea"></textarea>
     <label for="checkbox">Checkbox:</label>
      <input type="checkbox" name="checkbox" id="checkbox" value="checkbox" />

    <input type="submit" value="Submit" onclick="send();" />

	<div id="formData"></div>

	<p align="center"><b>HTML Output:</b></p>
	<div id="output"></div>

<p align="center"><b>HTML Load:</b></p>
	<div class="html-load"></div>
              @import "compass/css3";

body {
  margin: 2em;

#output {
  width: 60%;
  padding: 1em;
  border: 1px solid gray;
  margin: 2em auto;
  color: gray;
              $.fn.serializeObject = function() {
		    var o = {};
		    var a = this.serializeArray();
		    $.each(a, function() {
		        if (o[this.name] !== undefined) {
		            if (!o[this.name].push) {
		                o[this.name] = [o[this.name]];
		            o[this.name].push(this.value || '');
		        } else {
		            o[this.name] = this.value || '';
		    return o;

		$(function() {
		    $('#form').submit(function() {
		      // var formData = $('#form').serializeObject();
		      //$('#name').attr("value", "test");
		      //send(formData, "form");
		      return false;

		function send() {
		  var formData = $('#form').serializeObject();

		  var html = document.documentElement.outerHTML;
		  var values = {
		  var result = {
		    html: html

		  // var doc = document.implementation.createHTMLDocument(""); // works in Chrome, FF, IE
 			// doc.getElementsByTagName('html')[0].innerHTML = html;
		  for (var key in formData) {
		    if (formData.hasOwnProperty(key)) {
		      if ($(document.getElementsByName(key)).attr("type") == "radio" || $(document.getElementsByName(key)).attr("type") == "checkbox") {
		      	if( $(document.getElementById(formData[key])).is(':checked') ) {
		      } else if ( $(document.getElementById(key)).is('select') ) {
		      	var options = $(document.getElementById(key)).find("option");
            $.each(options, function() {
              if ($(this).is(':selected')) {$(this).attr("selected",true);} else { $(this).removeAttr("selected"); }
		      } else {

		      //alert( key + ": " + doc.getElementById(key).value );

		  $('#output').text( $('#form').html() );

		  return false;

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.


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