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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <body>
 <link href="https://fonts.googleapis.com/css?family=Pauta One" rel="stylesheet" typ="css/text">
 <div class="container text-center">
  <h1>Search for anything on Wikipedia</h1><br>
  <input class="form-control" type="text" id="searchTerm" /><br><br>
  <button id="search" type="button" class="btn btn-primary" target="_blank">Search</button><br><br>
	<!-- random article -->
  <p><a href="https://en.wikipedia.org/wiki/Special:Random" target="_blank">
    <button type="button" id="random" class="btn btn-primary">Go Random</button></a></p>
   <ul id="output">

   </ul>
 </div>
 <!-- container -->
</body>
              
            
!

CSS

              
                body {
	background-image: url("");
	background-repeat: no-repeat;
	background-color: #203556;
	color: white;
	padding: 100px; 
	font-family: "Pauta One", sans-serif;
}

#searchTerm {
	width: 50%;
	margin: 0px 280px;
	border: 5px solid #7c7f84;
  border-radius: 10px;
}

#search {
	border: 5px solid #7c7f84;
  border-radius: 30px;
}

#random {
	border: 5px solid #7c7f84;
  border-radius: 30px;
}





              
            
!

JS

              
                /* This programme allows the user to search for any Wikipedia value and 
receive 10 immediate results, using the Wikipeida API. It also enables
a random value request */ 


$(document).ready(function(){
	// run call when search button is clicked
	$("#search").click(function(){
		var searchTerm = $("#searchTerm").val();
		// API url with searchTerm
		var url = "https://en.wikipedia.org/w/api.php?action=opensearch&search=" + searchTerm + "&format=json&callback=?";
		
		// call Wikipedia API for data
		$.ajax({
				type: "GET", 
				url: url, 
				async: false, 
				dataType: "json", 
				success: function(data){					
 				// start with fresh and blank info
					$("#output").html(""); 
					// iterate through data from API and output to screen
					for (var i = 0; i < data[1].length; i++){
						$("#output").prepend("<br><div class='well'><a target='_blank' href= " + data[3][i] + data[1][i] + "</a><p>" + data[2][i] + "</p></div>");
					}
				$("#searchTerm").val("");	
				}, 
				error: function(errorMessage){
					alert("Could not retrieve data");
				}
		});
	});
	// make enter key trigger search function as well
	$("#searchTerm").keypress(function(e){
		if (e.which == 13){
			$("#search").click();
		}
	})
})
              
            
!
999px

Console