Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's 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 it's URL and the proper URL extention.

+ add another resource

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>query-map</title>
  <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

  <style>
    #Panel {
      padding: 30px;
      background-color: rgba(255, 255, 255, 0.8);
    }

    .esri-button {
      margin: 2px;
    }

    html,
    body,
    #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
    }
  </style>

  <!-- <link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/css/main.css"> -->
  <link
      rel="stylesheet"
      href="https://js.arcgis.com/4.11/esri/themes/light/main.css"
    />
  <script src="https://js.arcgis.com/4.11/"></script>

  <script>
    require([
      "esri/Map",
      "esri/views/MapView",
      "esri/layers/FeatureLayer",
      "esri/widgets/Expand",
      'dojo/dom',
      'dojo/on',
      "esri/tasks/support/Query",
      "esri/layers/GraphicsLayer",
      "esri/widgets/Feature",
    ], function (Map, MapView, FeatureLayer,Expand,dom, on,Query,GraphicsLayer,Feature) {
      
      var pointServiceLayerView;
      var pointService = new FeatureLayer({
        url: "https://services3.arcgis.com/1pxU2hJU9ZszJDcX/ArcGIS/rest/services/Young_Adult_Treatment_Facilities/FeatureServer/0",
        popupTemplate: {
           content: "{name1} in {city} has {OBJECTID}"
          },
        outFields: ["OBJECTID", "name1", "city"]
      });
      
      var map = new Map({
        basemap: "gray",
        layers: [pointService]
      });

      var view = new MapView({
        container: "viewDiv",
        map: map,
        center: [-102.370576, 40.172530],
        zoom: 5
      });
      
      view.whenLayerView(pointService).then(function(layerView){
        pointServiceLayerView = layerView;
        document.getElementById('input').addEventListener('change', function (e) {
          var input = e.target.value;
          var gushHelka;                 
          if (input) {
            gushHelka = "OBJECTID"
            }         
          else {
          gushHelka = "1",
          input = "1"      
          }                       
          var query = pointService.createQuery();     
          query.returnGeometry = true;
          query.where = gushHelka + " = " + input// input; 
          pointServiceLayerView.queryFeatures(query).then(succ, fail);                 });
        view.ui.add("Panel", "top-right");
      });
 
      ///edit the layer and zoom in
      function succ(featureSet) {
        var selectedGraphic = featureSet.features[0];
        var opts = {
          duration: 2000  // Duration of animation will be 5 seconds
        };

        // go to point at LOD 15 with custom duration
        view.goTo({
          target: [selectedGraphic],
          zoom: 15
        }, opts);
         view.popup.open({
           features: [selectedGraphic], // location of the click on the view
           fetchFeatures: true // display the content for the selected feature if a popupTemplate is defined.
        });
      }
      function fail(error) {
        console.error('An error ocurred in the query: ', error);
      };
    });
  </script>
</head>
<body>
  
  <div id="viewDiv"></div>
  <div id="Panel" class="esri-widget">
          <h2>גוש חלקה</h2>
    <input type="text" placeholder="חפש לפי גוש-חלקה" id="input" class="esri-input" >
    </input>
  </div>
</body>

</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console