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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

              <h1>Disable touch device keyboard for input fields</h1>

<input class="input" type="text" name="disabled-keyboard--input" value="Field with disabled keyboard" data-disable-touch-keyboard>

<input class="input" type="text" name="normal-input" value="Normal field">

<p>On touch devices, the first field does not trigger the keyboard because of the <strong>readonly</strong> attribute.</p>
<p>In this example the readonly attribute is only set via Modernizr touch device detection.<br>
  On desktop browsers it's a normal input field.</p>


<p><strong>Note:</strong> The field won't be accessible by tab on touch devices because readonly disables the tab functionality.</p>
              /* Basic input field styling */
.input {
  display: block;
  width: 250px;
  font-size: 15px;
  margin: 20px 0;
  padding: 10px 20px;
  border: 1px solid #ccc;
  background-color: #eee;
              $(document).ready(function() {
  if (Modernizr.touch) {
    // Disable keyboard by adding readonly attribute to field
     $('[data-disable-touch-keyboard]').attr('readonly', 'readonly');

    // Add field value via JavaScript
    $('[data-disable-touch-keyboard]').click(function() {
      var sampleConfirm = confirm('Would you like to add the current date & time as field value to demonstrate that the readonly field is still writable via JavaScript?');

      if (sampleConfirm === true) {
        $(this).val('Look, it works: ' + getDateTime());

// Returns current date & time
// Just as a sample - not feature relevant
// http://stackoverflow.com/a/19176102
function getDateTime() {
    var now     = new Date(); 
    var year    = now.getFullYear();
    var month   = now.getMonth()+1; 
    var day     = now.getDate();
    var hour    = now.getHours();
    var minute  = now.getMinutes();
    var second  = now.getSeconds(); 
    if(month.toString().length == 1) {
        var month = '0'+month;
    if(day.toString().length == 1) {
        var day = '0'+day;
    if(hour.toString().length == 1) {
        var hour = '0'+hour;
    if(minute.toString().length == 1) {
        var minute = '0'+minute;
    if(second.toString().length == 1) {
        var second = '0'+second;
    var dateTime = year+'/'+month+'/'+day+' '+hour+':'+minute+':'+second;   
     return dateTime;
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.