AnsweredAssumed Answered

Getting "cannot read property id of 'null' error when creating a Query()

Question asked by pierckbp on Oct 28, 2015
Latest reply on Oct 28, 2015 by pierckbp

I'm trying to work through a simple tutorial and whenever I get to the "var query = new Query();" line I get an error in chrome in init.js and cannot read id of null. Supposedly the error is on line 143 of init.js in b.get. I get the same error running locally with simpleHTTPServer or from cloud9.


**Code below in its entirety

<!DOCTYPE html>



  <link rel="stylesheet" href="">





<select id="population" name="population">

      <option value="" selected="selected">Select a population</option>

      <option value="2500">2,500</option>

      <option value="5000">5,000</option>

      <option value="7500">7,500</option>


  <div id="map">







<script src=""></script>












  'esri/graphic'], function(dom, on, array, Query, QueryTask, Map, Color, SimpleMarkerSymbol, SimpleLineSymbol, Graphic){


  var map = new Map('map', {

  basemap: 'streets',

  center: [-118.2095, 34.0866],

  zoom: 10


  var url = '';

     var markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE, 10, null, new Color([50,50,255]));


  function onQuerySuccess(featureSet) {;

     array.forEach(featureSet.features, function(feature){




  function onError(error){

     console.error('An eerror occurred in the query: ', error);




  on(dom.byId('population'), 'change', function(e) {

    var population =;

    if (population.length > 0) {

      var queryTask = new QueryTask(url);

      var query = new Query();

      query.where = 'TOTAL_POP > ' + population;

      query.returnGeometry = true;

      queryTask.execute(query).then(onQuerySuccess, onError);