Select to view content in your preferred language

geocoder problem

448
1
03-04-2014 09:23 AM
NanYe
by
New Contributor
Hi friends,

I was learning geocoder widgets. When I downloaded the example and ran the .html page locally, the geocoding function didn't work. It works just fine with the live example on the Esri website. Can any one help me solve this problem?
Thank you all!

This is the code I am talking about:

require([
        "esri/map", "esri/dijit/Geocoder", "dojo/domReady!"
      ], function(Map, Geocoder) {
        map = new Map("map",{
          basemap: "gray",
          center: [-120.435, 46.159], // lon, lat
          zoom: 7
        });

        geocoder = new Geocoder({
          map: map
        }, "search");
        geocoder.startup();
      });

Nan
0 Kudos
1 Reply
TimWitt
Frequent Contributor
Nan,

did you add the following code to your body?

<div id="search"></div>

and the following code to your style section?

      #search {
        display: block;
        position: absolute;
        z-index: 2;
        top: 20px;
        left: 74px;
      }
0 Kudos