cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

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.

<h1>Wikipedia Viewer</h1>	 
<a href="https://en.wikipedia.org/wiki/Special:Random">Random article: Take a Chance</a><br>

<form id="form" onsubmit="return search()">
	<input id="find" type="search">
	<input id="searchBtn" type="submit" value="Search">
<img src="http://calvarycentraloahu.com/codepen/wiki_logo.png" alt="wikipedia icon">
<div id="display"></div>
              body { 
  margin-top: 20px;
  background: #000;
  font-family: "arial", tahoma

h1, h2, h3 {
  text-align: center;
  color: #54a6f2;

a {
  font-size: medium;
  color: #54a6f2;

#form {
	font-size: 24px;
	margin: 20px 0 40px 0;
	color: #2E7D32;

#find {
	width: 350px;
	padding: 10px;
	height: 42px;
	background: #fff;
	border: 3px solid #9b9292;	

#search {
	height: 42px;
	width: 120px;
	background: #99d2ef;
	border: 3px solid #9b9292;	
	margin-left: -2px;

#searchBtn {
	height: 42px;
	width: 120px;
	background: #94ccef;
	border: 3px solid #a5a2a2;
	margin-left: -2px;

img {
    display: block;
    margin: 0 auto;

/* display results css  */
.result {
	background: #938c8c;
	box-shadow: 0 0 6px 2px rgba(0,0,0,.12);
  color: #000;
	margin: 24px 0;
	padding: 16px;

.title {
	font-weight: bold;
	font-size: 28px;
.text {
	font-size: 18px;

  //Cancels the event if it is cancelable, without stopping further propagation of the event.

function search(){
sq = $('#find').val();
//sq = Squares a number (multiplies a number by itself). The result is always a positive number, as multiplying two negative numbers always yields a positive result.   
//wikipedia API
$.getJSON("https://en.wikipedia.org/w/api.php?action=query&list=search&format=json&srsearch="+sq+"&srnamespace=0&srwhat=text&titles=Main%20Page&callback=?", function(d) {

$.each(d.query.search, function(i, item){
//display property show results			
var wiki = '<div class="result">'+
	'<div class="title">'+item.title+'</div>'+
	'<div class="text">'+item.snippet+'</div></div>';

Loading ..................