<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Checkbox onclick can not control the function, why? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/checkbox-onclick-can-not-control-the-function-why/m-p/453303#M41903</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried to create a check box to turn on/off a layer.&amp;nbsp; The checkbox is just html code, and I want to control it by using the method onclick, as the following: &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;&amp;lt;input type='checkbox' class='list_item' id='0' value=0&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; onclick="updateLayerVisibility();"/&amp;gt;PM2.5&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The updateLayerVisibility() is defined in &amp;lt;script&amp;gt; &amp;lt;/script&amp;gt; as the following: &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;function updateLayerVisibility (....DynamicLayer.visible = true; ) {}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did not finish the function yet, but the test run always indicated that function updateLayerVisibility () is not defined.&amp;nbsp; I am very confused, I put checkbox in &amp;lt;body&amp;gt; &amp;lt;/body&amp;gt; block, and put the function updateLayerVisibility() in the part B, like require ([ ...], fucniton () { part B}), why the onclick() is not working?&amp;nbsp; Any suggestion would hlep!&amp;nbsp; Thank you very much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 07 Jan 2014 20:17:58 GMT</pubDate>
    <dc:creator>LeiZhou</dc:creator>
    <dc:date>2014-01-07T20:17:58Z</dc:date>
    <item>
      <title>Checkbox onclick can not control the function, why?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/checkbox-onclick-can-not-control-the-function-why/m-p/453303#M41903</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I tried to create a check box to turn on/off a layer.&amp;nbsp; The checkbox is just html code, and I want to control it by using the method onclick, as the following: &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;&amp;lt;input type='checkbox' class='list_item' id='0' value=0&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; onclick="updateLayerVisibility();"/&amp;gt;PM2.5&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The updateLayerVisibility() is defined in &amp;lt;script&amp;gt; &amp;lt;/script&amp;gt; as the following: &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;function updateLayerVisibility (....DynamicLayer.visible = true; ) {}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I did not finish the function yet, but the test run always indicated that function updateLayerVisibility () is not defined.&amp;nbsp; I am very confused, I put checkbox in &amp;lt;body&amp;gt; &amp;lt;/body&amp;gt; block, and put the function updateLayerVisibility() in the part B, like require ([ ...], fucniton () { part B}), why the onclick() is not working?&amp;nbsp; Any suggestion would hlep!&amp;nbsp; Thank you very much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 20:17:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/checkbox-onclick-can-not-control-the-function-why/m-p/453303#M41903</guid>
      <dc:creator>LeiZhou</dc:creator>
      <dc:date>2014-01-07T20:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Checkbox onclick can not control the function, why?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/checkbox-onclick-can-not-control-the-function-why/m-p/453304#M41904</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It has to do with scope. Your function is not within the global scope, but within the DOJO scope.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Instead of having onclick on your html input, just use an on event inside your require block.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;on(dom.byId("0"), "click", function(evt){ // do something });&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;( Also, I would change the id of your input to something other than '0' )&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jan 2014 20:54:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/checkbox-onclick-can-not-control-the-function-why/m-p/453304#M41904</guid>
      <dc:creator>JonathanUihlein</dc:creator>
      <dc:date>2014-01-07T20:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: Checkbox onclick can not control the function, why?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/checkbox-onclick-can-not-control-the-function-why/m-p/453305#M41905</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 13 Jan 2014 20:53:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/checkbox-onclick-can-not-control-the-function-why/m-p/453305#M41905</guid>
      <dc:creator>LeiZhou</dc:creator>
      <dc:date>2014-01-13T20:53:03Z</dc:date>
    </item>
  </channel>
</rss>

