I am trying to hide a layer on the map like

      var point = new esri.geometry.Point(-106.61, 35.1107);
      point = esri.geometry.geographicToWebMercator(point);
      var symbol = new esri.symbol.PictureMarkerSymbol("https://cdn1.iconfinder.com/data/icons/Map-Markers-Icons-Demo-PNG/128/Map-Marker-Marker-Outside-Chartreuse.png", 32, 32);
      pointInfoTemplate = new InfoTemplate(); 
      pointInfoTemplate.setTitle("Project Details");
      pointInfoTemplate.setContent('<div>Some Att Here</div> ');
      var graphic = new esri.Graphic(point, symbol).setInfoTemplate(pointInfoTemplate);
      layer1 = new esri.layers.GraphicsLayer();

$("#hide").on("click", function(){

which works fine but the InfoTemplate() remains in the map (in case of it being opened)

enter image description here

  • What version of the JS API are you on?
    – GavinR
    Commented Sep 4, 2015 at 15:19

1 Answer 1


You'll have to have a reference to the map object in your event handler (do this using scope binding), but once you do you can do:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.