Hiding a div in a widget

01-19-2021 03:16 PM
by Anonymous User
Not applicable

I am trying to hide a div in my Measurement widget but my attempts have resulted in breaking the widget entirely. I have a div distanceMeasure and I want to hide it. How do I do it? Where does the code go in the widget.js file? 

Tags (2)
0 Kudos
2 Replies
MVP Emeritus

What do you mean it breaks the widget? What code are you using to hide that div?

0 Kudos
Esri Contributor

Hi @Anonymous User 

If you could attach your code, it would be easier for us to assist.


Generically speaking, if you had a div with id "distanceMeasure" declared in your html, you can hide the div like this in JS:


var selectedDiv = dojo.byId(divId);
if(selectedDiv) {
   selectedDiv.style.display = "none";


to show the same div, you can then call:


selectedDiv.style.display = "block";


Hope that helps.





0 Kudos