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.

              <nav class="navbar navbar-default navbar-static-top pull-left">
      <div class="container-fluid">
        <div class="navbar-header">
          <a class="navbar-brand" href="#">Wikipedia Viewer</a>

<section class="banner">
  <div class="container">
     <label id="label-text" class="text-center">Input Text & Press Enter</label>
      <input id="search-box" type="text" name="search" placeholder="Search">
     <button id="submit-button" type="submit">Submit</button>
  <div id="result-container" class="container-fluid">   
    <ul id="result-list"></ul>

  background: #85007A;

  background-color: rgba(0,0,0,0);
  padding: 20px;

  font-family: 'Pacifico', cursive;
  font-size: 40px;
  color: #CCA333 !important;

input[type=text] {
    width: 130px;
    box-sizing: border-box;
    border: 2px solid black;
    border-radius: 4px;
    font-size: 16px;
    background-color: white;
    padding: 12px 20px 12px 40px;
    margin: 10px 300px 10px 10px ;  
    -webkit-transition: width 0.4s ease-in-out;
    transition: width 0.4s ease-in-out;

input[type=text]:focus {
    width: 100%;
    border: 2px solid yellow;

  width: 100%;
  height: 300px;
  background-size: 100% 100%;

  display: block;
  margin-left: auto;
  margin-right: auto;

  margin-top: 150px;

  position: absolute; 
  left: -9999px;

  margin-left: 460px;
  font-family: 'Lato' !important;
  font-weight: bold;
  font-size: 24px;
  color: black;

ul {
    margin-top: 14px;
    padding: 20px 0px 0px 0px;
ul li {
    font-family: Lato !important;
    background: #cce5ff;
    padding: 5px 5px 0px 5px;
    margin-left: 35px;
    margin-right: 35px;

ul li:hover{
   background: orange;
var apiQuery = "";

  $("#submit-button").on("click", function(event){
    //Cancelling out the default event of submit button
    //initialize arrays for title and snippets
    var titleArr = [];
    var snippetArr = [];
    //empty previous contents
    //WebService Call to wikipedia
    apiQuery = ""+$("#search-box").val()+"&format=json&callback=?";
    //Get JSON data for the search query
        for(var i=0; i <; i++){
        //Adding Titles to array
        titleArr.push("<a href="[i].title.replaceAll(' ','_')+" target=\"_blank\"><li id=\"list-item\"><h3>"[i].title+"</h3>");
        //Adding Snippets to array
        //Appending the item to the list
        $('#result-list').append(titleArr[i] + snippetArr[i]);
      //delete both the arrays
      delete titleArr;
      delete snippetArr;

//Refocus clears value in text box
$("#search-box").focus( function(){ 

//Creating a replace all function for the link --> Credit to Chris West :
String.prototype.replaceAll = function(target, replacement) {
  return this.split(target).join(replacement);

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