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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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>ArcGIS JavaScript Tutorials: Create a Starter App</title>
  <style>
    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">
  <script src="https://js.arcgis.com/4.11/"></script>
  
  <script>  
    require([
      'dojo/dom',
      'dojo/on',
      'esri/Map',
      'esri/views/MapView',
      'esri/tasks/support/Query',
      'esri/layers/GraphicsLayer',
      'esri/Graphic',
      'esri/tasks/QueryTask',
    ], function (
      dom,
       on,
       Map,
       MapView,
       Query,
       GraphicsLayer,
       Graphic, 
       QueryTask
    ) {
     
//symbol for the result graphic
        var symbol = {
          type: "simple-marker",  // autocasts as new SimpleMarkerSymbol()
          style: "cross",
          color: [50,50,255],
          size: "10px",  // pixels
          outline: {  // autocasts as new SimpleLineSymbol()
            color: [ 255, 255, 0 ],
            width: 3  // points
                   }
      };
//service to query
      url = 'https://services.arcgis.com/V6ZHFr6zdgNZuVG0/arcgis/rest/services/la_county_labor_centroid/FeatureServer/0';
      
      var map = new Map({
        basemap: "gray"
      });
  //layer to display query
      var layer = new GraphicsLayer()
      
      ///get results and add them to a G-layer on the map
      function succ(featureSet){
        layer.removeAll();
        var graphic = featureSet.features.map(function(gra){
          gra.symbol = symbol;
          return gra;
        });
        layer.addMany(graphic);
        map.add(layer);
      };
        
      function fail (error){
        console.error('An error ocurred in the query: ', error);
      };
     
//lisetns to changes on the select then querys the service for value        
      on(dom.byId('population'),'change', function(e) {
         var population = e.target.value;
         if (population.length > 0) {
           var querytask = new QueryTask({
             url:url
           });
           var query = new Query();
           query.returnGeometry = true
           query.outFields = ["*"]
           query.where = "TOTAL_POP > " + population;
           
           //promise of result array or error
           querytask.execute(query).then(succ,fail)
         }
         
         })
      
      var view = new MapView({
        container: "viewDiv",
        map: map,
        center: [-118.80543,34.02700],
        zoom: 13
      });
     
    });
  </script>
</head>
<body>
  <select id="population" name="population">
<option value="" selected="selected">Select Population</option>
<option value="2500">2,500</option>
<option value="5000">5,000</option>
<option value="7500">7,500</option>
</select>
  <div id="viewDiv"></div>
</body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                
              
            
!
999px

Console