MapQuest.com
Business
Navigation
Getting Started
Developer Blog
Web SDKs
MapQuest.js
PlaceSearch.js
Examples
Basic
Fill out form
Find the Nearest Business
Franchises and Categories
Map the Results
No Style
Templating
APIs
Data Manager API
Directions API
Geocoding API
Icons API
Search API
Place Search API
Search Ahead API
Static Map API
Traffic API
Legacy Products
Leaflet Plugins
Tools
Lat/Lng Finder
Link to MapQuest
Share
Getting Started
Developer Blog
Documentation
Web SDKs
MapQuest.js
PlaceSearch.js
new
Examples
Basic
Fill out form
Find the Nearest Business
Franchises and Categories
Map the Results
No Style
Templating
APIs
Data Manager API
Directions API
Geocoding API
Icons API
Search API
Place Search API
Search Ahead API
Static Map API
Traffic API
Legacy Products
Leaflet Plugins
Tools
Lat/Lng Finder
Link to MapQuest
Share
PlaceSearch.js
Templating
Edit the code below and click "Try It Now" to display the result.
<html> <head> <script src="https://api.mqcdn.com/sdk/place-search-js/v1.0.0/place-search.js"></script> <link type="text/css" rel="stylesheet" href="https://api.mqcdn.com/sdk/place-search-js/v1.0.0/place-search.css"/> <script type="text/javascript"> window.onload = function() { placeSearch({ key: '8nIoYUx9GyjZsdehJySzjprSvZIqgM42', container: document.querySelector('#search-input'), collection: [ 'airport', ], templates: { header: function () { return '<span class="mq-header" />' }, value: function(result) { return result.name; }, suggestion: function(result) { return `Departing from: ${result.name} `; }, footer: function () { return '<span class="mq-footer" />' }, empty: function () { return '<div class="mq-result empty-result">No airports found</div>' }, } }); } </script> </head> <body style="border: 0; margin: 40px;"> <input type="search" id="search-input" placeholder="Departure Airport..." /> </body> </html>
Try It Now