Pen Settings



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


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.


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.


                <h1>Accessible Form Demo</h1>

<form class="form" action="" method="POST" id="form_application" name="form_application" enctype="multipart/form-data">

	<p class="requiredField" style="padding-left: 2px;"><b>Required Fields <span class="requiredLabel">*</span></b></p>
	<hr />

  <fieldset id="availability_info">
		<legend>Availability Info</legend>
    <div class="form-field"> 
      <label id="label_available_date" for="form_application_available_date">Date available to work: <span class="requiredLabel">*</span></label><br />
      <input type="date" name="available_date" id="form_application_available_date" pattern="\d{1,2}/\d{1,2}/\d{4}" required placeholder="MM/DD/YYYY" />

  <fieldset id="contact_info">
		<legend>Contact Info</legend>
    <div class="form-field"> 
      <label id="label_name" for="form_application_name">Name: <span class="requiredLabel">*</span></label></br />
      <input type="text" name="name" id="form_application_name" required placeholder="Your Name" size="30" maxlength="255" />

    <div class="form-field">
        <label id="label_3dc3f502c3" for="form_application_3dc3f502c3">Email: <span class="requiredLabel">*</span></label></br />
      <input type="email" name="3dc3f502c3" id="form_application_3dc3f502c3" required placeholder="" size="30" maxlength="255" />
      <input type="text" name="email" value="" aria-label="email" style="display: none;" aria-hidden="true" />

    <div class="form-field">
      <label id="label_state" for="form_application_state">State: <span class="requiredLabel">*</span></label><br />
      <datalist id="form_application_state_list">
        <select name="state_select" title="State" id="form_application_state_select" required>
          <option value="" selected>-- Please Select --</option>
          <optgroup label="U.S. States">
            <option value="AL">Alabama</option>
            <option value="AK">Alaska</option>
            <option value="AZ">Arizona</option>
            <option value="AR">Arkansas</option>
            <option value="CA">California</option>
            <option value="CO">Colorado</option>
            <option value="CT">Connecticut</option>
            <option value="DE">Delaware</option>
            <option value="DC">District Of Columbia</option>
            <option value="FL">Florida</option>
            <option value="GA">Georgia</option>
            <option value="HI">Hawaii</option>
            <option value="ID">Idaho</option>
            <option value="IL">Illinois</option>
            <option value="IN">Indiana</option>
            <option value="IA">Iowa</option>
            <option value="KS">Kansas</option>
            <option value="KY">Kentucky</option>
            <option value="LA">Louisiana</option>
            <option value="ME">Maine</option>
            <option value="MD">Maryland</option>
            <option value="MA">Massachusetts</option>
            <option value="MI">Michigan</option>
            <option value="MN">Minnesota</option>
            <option value="MS">Mississippi</option>
            <option value="MO">Missouri</option>
            <option value="MT">Montana</option>
            <option value="NE">Nebraska</option>
            <option value="NV">Nevada</option>
            <option value="NH">New Hampshire</option>
            <option value="NJ">New Jersey</option>
            <option value="NM">New Mexico</option>
            <option value="NY">New York</option>
            <option value="NC">North Carolina</option>
            <option value="ND">North Dakota</option>
            <option value="OH">Ohio</option>
            <option value="OK">Oklahoma</option>
            <option value="OR">Oregon</option>
            <option value="PA">Pennsylvania</option>
            <option value="RI">Rhode Island</option>
            <option value="SC">South Carolina</option>
            <option value="SD">South Dakota</option>
            <option value="TN">Tennessee</option>
            <option value="TX">Texas</option>
            <option value="UT">Utah</option>
            <option value="VT">Vermont</option>
            <option value="VA">Virginia</option>
            <option value="WA">Washington</option>
            <option value="WV">West Virginia</option>
            <option value="WI">Wisconsin</option>
            <option value="WY">Wyoming</option>
          <optgroup label="Canadian Provinces">
            <option value="AB">Alberta</option>
            <option value="BC">British Columbia</option>
            <option value="MB">Manitoba</option>
            <option value="NB">New Brunswick</option>
            <option value="NL">Newfoundland and Labrador</option>
            <option value="NT">Northwest Territories</option>
            <option value="NS">Nova Scotia</option>
            <option value="NU">Nunavut</option>
            <option value="ON">Ontario</option>
            <option value="PE">Prince Edward Island</option>
            <option value="QC">Quebec</option>
            <option value="SK">Saskatchewan</option>
            <option value="YT">Yukon Territory</option>
        </select><br /><br />
        <em>If other, please specify:</em><br />
      <input type="text" name="state_other" id="form_application_state" placeholder="Your State/Province" list="form_application_state_list" value="" size="20" maxlength="255" required />

    <div class="form-field">
      <label id="label_zip" for="form_application_zip">Zip:</label></br />
      <input type="text" name="zip" id="form_application_zip" placeholder="#####" size="15" maxlength="50" pattern="^(?:[\d]{5}(-[\d]{4})?|([A-Za-z]\d[A-Za-z][ -]?\d[A-Za-z]\d))$" />

    <div class="form-field">
      <label id="label_phonenumber" for="form_application_phonenumber">Phone: <span class="requiredLabel">*</span></label></br />
      <input type="tel" name="phonenumber" id="form_application_phonenumber" required placeholder="###-###-####" size="15" maxlength="50" />

  <hr />
  <fieldset class="toggle form_application_qualifications_method_2 field-fl-l" id="education">
      <fieldset class="form-field">
        <legend>Did you graduate?:</legend>
<input type="radio" name="advanced_degree_graduate" value="Yes" id="form_application_advanced_degree_graduate_1" /> <label for="form_application_advanced_degree_graduate_1" style="font-weight: normal;">Yes</label> &nbsp; 
<input type="radio" name="advanced_degree_graduate" value="No" id="form_application_advanced_degree_graduate_2" /> <label for="form_application_advanced_degree_graduate_2" style="font-weight: normal;">No</label></fieldset>

	<fieldset id="agreement">
		<p><em>I certify that answers given herein are true and complete.</em></p>
		<p><em>I authorize investigation of all statements in this application for employment as may be necessary in arriving at any employment decision. I understand that this application is not and is not intended to be a contract of employment. If employed, I may terminate employment at any time for any reason, and the Company may terminate my employment at any time for any reason.</em></p>
		<p><em>If employment is obtained and it is discovered that false or misleading information has been given in my application or interview(s), I understand that this may result in discharge.</em></p>
		<fieldset class="form-field"><legend>Acceptance: <span class="requiredLabel">*</span></legend>
<input type="checkbox" name="truth_agreement[]" value="true" id="form_application_truth_agreement_1" required /> <label for="form_application_truth_agreement_1" style="font-weight: normal;">I Agree</label></fieldset>
<hr />

	<p>When finished, click <b>Submit Application</b> button below.</p>
	<p style="text-align: center;"><input type="submit" name="submit" value="Submit Application" aria-label="submit" style="font-size: 24px;" /></p>

	<p style="text-align: center;"><b><span class="api" aria-label="A P I">APi</span> Group Inc. IS AN EQUAL OPPORTUNITY EMPLOYER</b></p>


<script type="text/gentle-template" id="form-errors">
  <div data-errors-when="patternMismatch" class="field-error">Invalid value.</div>
  <div data-errors-when="rangeOverflow" class="field-error">Invalid value.</div>
  <div data-errors-when="rangeUnderflow" class="field-error">Invalid value.</div>
  <div data-errors-when="stepMismatch" class="field-error">Invalid value.</div>
  <div data-errors-when="tooLong" class="field-error">Invalid value.</div>
  <div data-errors-when="typeMismatch" class="field-error">Invalid value.</div>
  <div data-errors-when="valueMissing" class="field-error">This field is required.</div>


                /* begin base styles */
@import url('//,300italic,700,700italic');

html {
	/* Prevent font scaling in landscape while allowing user zoom */
	text-size-adjust: 100%;
	font-size: 16px;
	box-sizing: border-box;

body {
  font-family: 'Roboto', sans-serif;
	font-size: 1em;
	line-height: 1.4em;
  margin: 2em;
  color: #333;
  overflow-x: hidden;

.visuallyhidden {
	position: absolute;
	overflow: hidden;
	clip: rect(0 0 0 0);
	height: 1px;
	width: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
/* end base styles */

.formresult {
	font-size: 1em;
	margin: 25px 0;
	padding: 15px;
	background-color: #fff;
	color: #000;
.displayOK { border: 1px solid #999; }
.displayErr { border: 2px solid #f00; }
.requiredLabel { color: #c00; font-weight: bold; }

.form {
	select {
		border: 1px solid #ccc;
		background-color: #fff;
		color: #000;
		margin: 0 0 2px 0;
		padding: 0.25em 0 0.25em 2px;
		max-width: 21em;
		font-size: inherit;
		line-height: normal;
		@media only screen and (max-width: 600px) {
			max-width: 100% !important;
			width: 100%;
	textarea {
		width: 100%;
	select {
		padding: 0;
	input[type=button] {
		padding: 4px 6px;
		font-size: 1.2em;
		font-weight: bold;
		background-color: #eee;
		@media only screen and (max-width: 600px) {
			width: auto;
	input[type=image] {
		display: inline;
		border: none;
		background: none;
		@media only screen and (max-width: 600px) {
			width: auto;
	.requiredField { border-left: 3px solid #c00; }
	textarea[required] {
		border-top: 2px solid #ccc;
		border-left: 3px solid #c00;
	label {
		//display: block;
		font-weight: bold;
	fieldset {
		margin: 1em 0;
		border: none;
		width: auto;
		padding: 0;
	legend {
		font-weight: bold;
		font-size: 1.5em;
		margin: 0.5em 0;
		line-height: 1.5em;
	fieldset fieldset {
		legend {
			font-size: 1em;
			margin: 0;
			line-height: 1em;
	textarea {
		&::placeholder {
			color: #888;
			font-style: italic;
			&:focus {
				color: inherit;
				font-style: inherit;
	.form-field {
		margin: 1em 0;
  .field-error {
    //display: none;
    color: #c00;



                window.addEventListener('DOMContentLoaded', function() {
  //fix required datalists
  //enable accessibility

function fixRequiredDatalists(formId) {
  $('#'+formId+' datalist').each(function() {
    if (!$(this).is('visible')) {
      var datalistId =;
      var fieldsetId =, - ('_list').length);
      var selectId = fieldsetId+'_select';
      var inputId = fieldsetId;
      if ($('#'+selectId).prop('required') && $('#'+inputId).prop('required')) {
        var $inputs = $('#'+selectId+',#'+inputId);
        $inputs.on('input', function () {
          // Set the required property of the other input to false if this input is not empty.
          $inputs.not(this).prop('required', !$(this).val().length);

function enableFormAccessibility(formId) {
  var form = document.getElementById(formId);

  //add aria hints and error placeholders
  $('#'+formId+' *').filter(':input:visible').each(function() {
    if (this.placeholder && this.placeholder.length > 0) {
      //add aria hints equal to placeholder text
      $('<div id="''_hint" class="visuallyhidden">'+this.placeholder+'</div>').insertBefore( $(this));

    //add error message placeholders
    $('<div data-errors-for="''" data-include="form-errors"></div>').insertBefore( $(this));

  //disable browser form validation for GentleForm
  $('#'+formId).attr('novalidate', '');

  //enable GentleForm
  GentleForm(form, function onSubmit (event) {
    if (this.isValid()) {
      //form is valid
      return true;
    } else {
      //form is invalid