Pen Settings

HTML

CSS

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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
 
  
<div class="container" style="margin-top: 20px;">
    <div class="row">
        
        <div class="col-lg-6 col-sm-6 col-12">
            <div class="jumbotron">
                <h1>Bootstrap File Input Demo</h1>
            </div>
        </div>
        
        <div class="col-lg-6 col-sm-6 col-12">
            <h4>Standard Button</h4>
            <label class="btn btn-primary">
                Browse&hellip; <input type="file" style="display: none;">
            </label>
        </div>
        <div class="col-lg-6 col-sm-6 col-12">
            <h4>Block-level Button
            <label class="btn btn-block btn-primary">
                Browse&hellip; <input type="file" style="display: none;">
            </label>
        </div>
        
        <div class="col-lg-6 col-sm-6 col-12">
            <h4>Button Groups</h4>
            <div class="btn-group">
                <a href="#" class="btn btn-default">Action 1</a>
                <a href="#" class="btn btn-default">Action 2</a>
                <label class="btn btn-primary">
                    Browse&hellip; <input type="file" style="display: none;">
                </label>
            </div>
        </div>
        <div class="col-lg-6 col-sm-6 col-12">
            <h4>Input Groups</h4>
            <div class="input-group">
                <label class="input-group-btn">
                    <span class="btn btn-primary">
                        Browse&hellip; <input type="file" style="display: none;" multiple>
                    </span>
                </label>
                <input type="text" class="form-control" readonly>
            </div>
            <span class="help-block">
                Try selecting one or more files and watch the feedback
            </span>
        </div>
        
    </div>
</div>
              
            
!

CSS

              
                
              
            
!

JS

              
                $(function() {

  // We can attach the `fileselect` event to all file inputs on the page
  $(document).on('change', ':file', function() {
    var input = $(this),
        numFiles = input.get(0).files ? input.get(0).files.length : 1,
        label = input.val().replace(/\\/g, '/').replace(/.*\//, '');
    input.trigger('fileselect', [numFiles, label]);
  });

  // We can watch for our custom `fileselect` event like this
  $(document).ready( function() {
      $(':file').on('fileselect', function(event, numFiles, label) {

          var input = $(this).parents('.input-group').find(':text'),
              log = numFiles > 1 ? numFiles + ' files selected' : label;

          if( input.length ) {
              input.val(log);
          } else {
              if( log ) alert(log);
          }

      });
  });
  
});
              
            
!
999px

Console