<?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 Re: Toggle Layers using Checkbox in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggle-layers-using-checkbox/m-p/114492#M10687</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All you have to do is add a listener to the checkbox that sets the visible property of the layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;var checkbox = document.getElementById("Checkbox1");
checkbox.onclick = function () {
&amp;nbsp; fl5.visible = this.checked;
}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 06:47:00 GMT</pubDate>
    <dc:creator>KenBuja</dc:creator>
    <dc:date>2021-12-11T06:47:00Z</dc:date>
    <item>
      <title>Toggle Layers using Checkbox</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggle-layers-using-checkbox/m-p/114490#M10685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Attention:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/3856"&gt;Ken Buja&lt;/A&gt;‌&lt;/P&gt;&lt;DIV class="" style="border: 0px; font-weight: inherit; padding: 30px 50px;"&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;Created Feature Layer class as&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;const fl5 = new FeatureLayer({&lt;BR /&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;url: "***"&lt;/SPAN&gt;&lt;BR /&gt;});&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;Added the&amp;nbsp;Map&amp;nbsp;as&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;var map = new Map({&lt;BR /&gt;basemap: app.basemap,&lt;BR /&gt;layers: [ ]&lt;BR /&gt;});&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;Created&amp;nbsp;a&amp;nbsp;checkbox as&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&amp;lt;div class="form-check"&amp;gt;&lt;BR /&gt; &amp;lt;input class="form-check-input" type="checkbox" id="Checkbox1" value="option1"&amp;gt;&lt;BR /&gt; &amp;lt;label class="form-check-label" for="Checkbox1"&amp;gt;Wells&amp;lt;/label&amp;gt;&lt;BR /&gt; Default checkbox&lt;BR /&gt; &amp;lt;/div&amp;gt;&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;Now, how can I&amp;nbsp;toggle the Layer (fl5) using the checkbox?&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;&lt;/P&gt;&lt;P style="border: 0px; font-weight: inherit;"&gt;Thanks in advance.&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 22 Jul 2018 07:18:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggle-layers-using-checkbox/m-p/114490#M10685</guid>
      <dc:creator>BulbulMajumder1</dc:creator>
      <dc:date>2018-07-22T07:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle Layers using Checkbox</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggle-layers-using-checkbox/m-p/114491#M10686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Something like this maybe:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://codepen.io/anon/pen/rryRpz?&amp;amp;editors=100" title="https://codepen.io/anon/pen/rryRpz?&amp;amp;editors=100"&gt;Toggle Feature Layer&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Davide&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jul 2018 14:22:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggle-layers-using-checkbox/m-p/114491#M10686</guid>
      <dc:creator>DavideLimosani</dc:creator>
      <dc:date>2018-07-23T14:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: Toggle Layers using Checkbox</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggle-layers-using-checkbox/m-p/114492#M10687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All you have to do is add a listener to the checkbox that sets the visible property of the layer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;var checkbox = document.getElementById("Checkbox1");
checkbox.onclick = function () {
&amp;nbsp; fl5.visible = this.checked;
}&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:47:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/toggle-layers-using-checkbox/m-p/114492#M10687</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T06:47:00Z</dc:date>
    </item>
  </channel>
</rss>

