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

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


                <body class="container">
  <h1>Wikipedia Random Article Generator & Article Search</h1>

  <input type="button" class="btn btn-primary center-block" value="Click here to generate a random article" onclick="'')">

  <form role="form">
    <div class="form-group">
      <input type="search" class="form-control center-block" placeholder="Search for an article">
    <input type="submit" class="btn btn-primary center-block" value="Submit">

  <div id="result"></div>


                body {
  font-family: calibri;
  background-color: #f2f2f2;

h1 {
  text-align: center;
  padding: 20px;

.btn {
  font-size: 18px;

form {
  padding: 40px;
  margin-top: 40px;

.form-control {
  height: 40px;

input[type="submit"] {
  width: 100%;

input[type=search] {
  text-align: center;
  font-size: 18px;

.effect {
  border: 3px solid white;
  background-color: white;
  box-shadow:0 1px 2px #aaa;
  font-size: 16px;
  padding: 10px;

#result {
  padding: 40px;


                var main = function() {

  $('form').submit(function(event) {
    var $input = $('input');
    var comment = $input.val();
    $.getJSON("" + comment + "&prop=info&inprop=url&callback=?", function(json) {
      if (json.query.searchinfo.totalhits === 0) {
        $('#result').append("<div class='effect'>No result found. Please try again.</div>")
      } else {
        for (var i = 0; i < 9; i++) {
          var caption =[i].title;
          var url = caption.replace(/ /g, "_");
          $('#result').append("<div class='effect'><a href='" + url + "' target='_blank'>" + caption + "</a>" + "<br>" +[i].snippet + "</div>" + "<br>")

    return false;