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.

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


                <h1>Date Field Experiment</h1>
<form id="Form">
    Please enter dates in U.S. format (Month / Day / Year).
    <label for="BDay01" id="BDay01Label">Birth date <span>(MM/DD/YYYY)</span>:</label>
    <input type="text" id="BDay01" aria-labelledby="BDay01Label BDay01error" aria-describedby="BDay01confirm" onblur="valiDate(,'BDay01confirm','BDay01error');">
    <output class="confirm" id="BDay01confirm" aria-live="assertive" for="BDay01" form="Form"></output>
    <div class="error" id="BDay01error"></div>
    <label for="EDay01" id="EDay01Label">End date <span>(MM/DD/YYYY)</span>:</label>
    <input type="date" id="EDay01" aria-labelledby="EDay01Label EDay01error" aria-describedby="EDay01confirm" onblur="valiDate(,'EDay01confirm','EDay01error');">
    <output class="confirm" id="EDay01confirm" aria-live="assertive" for="EDay01" form="Form"></output>
    <div class="error" id="EDay01error"></div>
    <input type="submit" value="Do not submit" onclick="return false;">
  For my blost post <cite><a href="">Maybe You Don’t Need a Date Picker</a></cite>.


                body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
    Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  line-height: 1.4;

label, output {
  display: block;

form div {
  margin: 1em 0;

form input + div, form input + div + div {
  margin: 0;

label span {
  font-size: 80%;

input {
  border: .1em solid #000;
  font: inherit;
  width: 9em;

input:focus {
  border-color: #00f;

input[type=submit] {
  color: #fff;
  background: #000;

input[type=submit]:focus, input[type=submit]:hover {
  color: #000;
  background: #eee;

output, .error {
  margin: .5em 0;

output:empty, .error:empty {
  margin: 0;

.error {
  color: #c00;
  padding-left: 1.75em;
  background-image: url(;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: 1.35em;

input[aria-invalid=true], input[aria-invalid=true]:focus {
  border-color: #c00;
  outline: .1em solid #c00;


                function valiDate(fieldID, confirmID, errorID) {
  var field = document.getElementById(fieldID);
  var confirm = document.getElementById(confirmID);
  var error = document.getElementById(errorID);
  var d = field.value;
  // alert(d);
  // alert(!isNaN(Date.parse(d)));
  if (!isNaN(Date.parse(d))) {
    error.innerText = "";
    var objDate = new Date(field.value);
    // alert(objDate);
    var theYear = objDate.getFullYear();
    var theMonth = objDate.getMonth();
    (locale = "en-us"),
      (theMonth = objDate.toLocaleString(locale, { month: "long" }));
    var theDay = objDate.getDate();
    confirm.innerText =
      "You entered " + theMonth + " " + theDay + ", " + theYear + "."
  } else {
    // alert('blank');
    confirm.innerText = "";
    error.innerText = "Please enter a date.";