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.


	This page was written as an assignment for It allows the user to randomly view a wikipedia page or search for one of there own. When the user searches a list should be given of all the possible results the user may have wanted so they can choose the appropriate page.
Author: Anthony Divitto
				( With some notable guidance from BlueCodeA on the forum. Thanks Man! )

@import url('|Oleo+Script');
		<h1 style="text-align:center; margin-top:5%; font-size:500%">FCC Wikpedia Viewer</h1>
		<!-- Get link to random page from project home page for this link-->
		<h1 style="text-align:center;">Click <a target="_blank" href="">here</a> to view a random page.</h1>
		<div class="container-fluid row">
			<div class="col-xs-3"></div>
				<input id="searchBox" type="text" value="Enter search here" class="col-xs-7"></input>
				<button id="submitButton" class="col-xs-2">Search</button>
		<div id="searchResults"></div>



                body {
  font-family: 'Oleo Script', cursive;
#searchBox {
#submitButton {
.result {
	margin: 2% 0% 0% 10%;
	font-family: 'Kalam', cursive;


                $( "document" ).ready( function( ) {
	$( "#submitButton" ).click( function( ) {
		var searchValue = "";
		// make sure the user has entered something to be searched for
		if( document.getElementById("searchBox").value !==	"" && document.getElementById( "searchBox" ).value !== "Enter search here" ) {
			searchValue = document.getElementById("searchBox").value;
			$.ajax( {
				// the link to receive the json with all the results
   			url: "" + searchValue + "&format=json&callback=?",
				// i'm not 100% on what data is doing here...
    		data: searchValue,
				// set the type of data to be received
    		dataType: 'json',
				// not sure what the next two lines are doing
    		type: 'POST',
    	  headers: { 'Api-User-Agent': 'Example/1.0' },
				// call this method if getting the json was possible
    	  success: function( json ) {
						// this while loop is suppossed to clear out any old results if any from prev searches
						// note: removed in favor of the empty() method as suggested by BlueCodeA
						// while( $( "#searchResults" ).firstChild ) $( "#searchResults" ).removeChild( $( "#searchResults" ).firstChild );
					  $( "#searchResults" ).empty();
						// the for loop is what builds the searchResults div tag
						for( var i = 0; i < json[1].length; i++ ) {
							// Thx BlueCodeA for pointing out that my links in the following line were not working with spaces using json[3][i] fixes the problem
							$( "#searchResults" ).append( "<div class='result'><a target='_blank' href=" + json[3][i] + '><u>' + json[1][i] + "<br>" + json[3][i] + "</u></a><br><p>" + json[2][i] + "</p></div>" );
						// erase the value of the search box so ifthe user wants to search again they don't have to erase themselves
						document.getElementById( "searchBox" ).value = "";
				// call if there was a problem getting the results
				error: function(  ) {
					alert( "ERROR!!" );
		} else { // the user did not enter a proper query