TypeError: e is null http://js.arcgis.com/3.9/ Line 136
TypeError: Unable to get property 'style' of undefined or null reference
Solved! Go to Solution.
<script type="text/javascript"> ... // Keep a reference to the loading icon DOM node. var loading = dom.byId("loading"); var loading1 = dom.byId("loading1"); var loading2 = dom.byId("loading2");
<img id="loading2" src="images/loading2.gif"></img>
domStyle.set(loading, "display", "inline-block");
domStyle.set(loading1, "display", "inline-block");
<script type="text/javascript"> ... // Keep a reference to the loading icon DOM node. var loading = dom.byId("loading"); var loading1 = dom.byId("loading1"); var loading2 = dom.byId("loading2");
<img id="loading2" src="images/loading2.gif"></img>
domStyle.set(loading, "display", "inline-block");
domStyle.set(loading1, "display", "inline-block");
This issue appears to be related to your loading images.<script type="text/javascript"> ... // Keep a reference to the loading icon DOM node. var loading = dom.byId("loading"); var loading1 = dom.byId("loading1"); var loading2 = dom.byId("loading2");
In your HTML there is an image element with id="loading2":<img id="loading2" src="images/loading2.gif"></img>
However, there are no elements with ids of "loading" or "loading1" in the page.
Your extractByCounty function attempts to show the element with id "loading":domStyle.set(loading, "display", "inline-block");
Your extractByUnit function attempts to show the element with id "loading1":domStyle.set(loading1, "display", "inline-block");
In both cases these elements do not exist in the HTML so you are getting the 'e is null' error when the Javascript code attempts to set the style of the element.
You could either change the Javascript to use the same loading image element ("loading2") or create the other two HTML image elements to fix the issue.
Owen
www.spatialxp.com.au
Good to hear it is working.
Debugging JS can be a pain. Chrome developer tools can be really helpful for these type of issues: https://developer.chrome.com/devtools/index
Also - make sure to remove all of the console.log() lines from your final code as they can cause issues in old versions of IE.
Owen
www.spatialxp.com.au