Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

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


                <div class="container">
	<h1>GeoNames Search and Twitter’s typeahead.js</h1>
  <p>A combination of the GeoNames Search API, Twitter Bootstrap 3, and Twitter’s typeahead.js library</p>
  <h3>Demo Form</h3>
	<form action="#">
		<div class="form-group">
			<label for="location-1">Search for a location</label>
			<input id="location-1" type="text" class="form-control typeahead" placeholder="Cannes" data-provide="typeahead" autocomplete="off">
    <li><a href="">GeoNames Search Webservice</a> (API Documentation)</li>
    <li><a href="">Twitter Bootstrap</a></li>
    <li><a href="">Twitter typeahead.js</a></li>
    <li><a href="">Twitter Hogan.js JavaScript templating</a></li>



                h3 {
  margin-top: 2em;

 * Fix full width inputs

.twitter-typeahead {
  display: block !important;

 * Additional CSS for Twitter Bootstrap compatibility
 * by

.twitter-typeahead .tt-query,
.twitter-typeahead .tt-hint {
  margin-bottom: 0;

.tt-dropdown-menu {
  min-width: 160px;
  margin-top: 2px;
  padding: 5px 0;
  background-color: #fff;
  border: 1px solid #ccc;
  border: 1px solid rgba(0,0,0,.2);
  *border-right-width: 2px;
  *border-bottom-width: 2px;
  -webkit-border-radius: 6px;
     -moz-border-radius: 6px;
          border-radius: 6px;
  -webkit-box-shadow: 0 5px 10px rgba(0,0,0,.2);
     -moz-box-shadow: 0 5px 10px rgba(0,0,0,.2);
          box-shadow: 0 5px 10px rgba(0,0,0,.2);
  -webkit-background-clip: padding-box;
     -moz-background-clip: padding;
          background-clip: padding-box;

.tt-suggestion {
  display: block;
  padding: 3px 20px;
} {
  color: #fff;
  background-color: #0081c2;
  background-image: -moz-linear-gradient(top, #0088cc, #0077b3);
  background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0077b3));
  background-image: -webkit-linear-gradient(top, #0088cc, #0077b3);
  background-image: -o-linear-gradient(top, #0088cc, #0077b3);
  background-image: linear-gradient(to bottom, #0088cc, #0077b3);
  background-repeat: repeat-x;
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0)
} a {
  color: #fff;

.tt-suggestion p {
  margin: 0;



                var geoNamesUsername = 'uberboomtest';

 * Initialize typeahead.js
	name: $(this).attr('id'),
	remote: {
		url: '' + geoNamesUsername + '&lang=de&style=full',
		filter: function(parsedResponse) {
			var result = [];
			for (var i=0; i<parsedResponse.geonames.length; i++) {
				var geonameId = parsedResponse.geonames[i].geonameId;
					name: parsedResponse.geonames[i].name,
					value: parsedResponse.geonames[i].name,
					geonameId: geonameId,
					countryName: parsedResponse.geonames[i].countryName,
					lat: parsedResponse.geonames[i].lat,
					lng: parsedResponse.geonames[i].lng,
					bbox: parsedResponse.geonames[i].bbox,
			return result;
	template: [
		'<p class="geo-name">{{name}}</p>',
		'<p class="geo-country text-muted">{{countryName}}</p>'
	engine: Hogan

 * Fix tt hint
$('.typeahead').on('typeahead:initialized', function(e, data) {
	// fix for using twitter bootstrap
	var hint = $('.tt-hint');
	var small = $('.input-sm');
	var large = $('.input-lg');
	if (small) {
	} else if (large) {
	} else {