TransWikia.com

Specific div elem for click event within view.when/view.on

Geographic Information Systems Asked on April 16, 2021

view.when(function(){
    view.on("click", function () { doSomething = !doSomething;});      
});

The above works as a global click event. HOWEVER, I am trying to specify a specific div elem not a global elem. i.e. The logic I’d like:

view.when(function(){
    view.on("click", #myDivElm function () { doSomething = !doSomething;});        
});

One Answer

You can set a click event for the element itself.

var myElement = dom.byId("myElement");
on(myElement, "click", function(evt){
  doSomething = !doSomething;
});

Answered by kenbuja on April 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP