Select to view content in your preferred language

Hiding a div in a widget

963
2
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
RobertScheitlin__GISP
MVP Emeritus

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

0 Kudos
DerrickWong
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.

 

Regards,

 

Derrick

0 Kudos