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.


  <title>Wikipedia Viewer</title>

  <div id="searchBox" class="">
    <input type="text" id="searchField" class="form-control">
    <div class="row justify-content-center">
      <button id="searchButton" class="btn btn-primary">Search</button>
      <button id="randomPageButton" class="btn btn-primary" onclick="randomPage()">Random Article</button>

  <ul id="output">

      <footer class="text-center">
        Made by <a href="" target="_blank">Radek John,</a> with use of Wikipedia <a href="" target="_blank">API</a>.


                li {
  list-style-type: none;
  margin-bottom: 5%;

button {
  margin: 3%;

#searchBox {
  margin: 25%;

#output {
  margin: auto 10%;


                $(document).ready(function() {

  // Wait for click  
  $("#searchButton").click(function() {
    // Variable for search term
    var question = "";
    // Varible for API url
    var url = "";
    // Set search term = content of search field
    question = $("#searchField").val();
    // Create API url
    url = "" + question + "&format=json&callback=?";

    // Get API -- I had to use coding360 tutorial for this part :-(

      url: url,
      async: false,
      dataType: "json",
      type: "GET",
      success: function(data) {
          // Remove old results
          // Go through data
          for (var i = data[1].length - 1; i >= 0; i--) {
            // Ad item to the list of results  
            $("#output").prepend("<li>" +
              // Make h6 header inside link 
              "<a href=" + data[3][i] + ">" +
              "<h6>" + data[1][i] + "</h6>" +
              "</a>" +
              // Ad text
              // Close list item

          $("#searchBox").css("margin-top", "0%");
          $("#searchBox").css("margin-bottom", "0%");

        // Belongs to  $.ajax( ...    
    // Belongs to  $("#searchButton")...  

  // Belongs to  $(document).ready ... 

// Go to random Wikipedia page
function randomPage() {"");