O'Reilly logo

OpenLayers 3 : Beginner's Guide by Erik Hazzard, Paul Spencer, Thomas Gratier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – adding dynamic tags to your map

Let's add some more interaction to our map now. We'll add an input box that will change the requested Flickr data based on the user's input:

  1. First, we'll add an input box and button to the HTML page. We'll put them into a div after the map and before the photo information:
    <div id="search" style="position: absolute; top: 10px; right: 10px; padding: 5px; background-color: rgba(255,255,255,0.5);">
      <input type="text" placeholder="Search photos by tag(s)" style="width: 200px">
      <button type="button">Search</button>
    </div>
  2. Next, we'll need to replace our $.ajax call with a function that will get called when the button is clicked. This function will do three things. First, it will clear the existing features ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required