//functions for turning layer on/off function toggleLayer(layerId) { var layer = app.map.getLayer(layerId); if (layer.visible) { layer.hide(); } else { layer.show(); } }
<button id="btnWICvendor" dojotype="dijit.form.Button" onClick="toggleLayer('venLayer')"> Click to Hide Sites</button>
registry.byId('btnWICvendor').on('click', toggleLayer);
Solved! Go to Solution.
registry.byId('btnWICoffSat').on('click', function (){ toggleLayer('offSatLayer')});
registry.byId('btnWICoffSat').on('click', function (){ toggleLayer('offSatLayer')});
require([ ... "dojo/query", ... ], function( ... query, //This is the DOJO query! lower case! ... ) { ... var vendorButton = query("#btnWICvendor"); vendorButton.on("click", toggleLayer);