I have a button that is hidden on a form. The form is for sign supports. If there is more than related sign, my button should display, but it is not.
Here is an excerpt of the code-
HTML:
<button id="btnRelatedSigns" type="button" style="visibility:hidden">Signs</button>
JavaScript:
// display number of related records in console queryTask.executeForCount(query, function (count) { console.log(count); if (count >= 1) { document.getElementById("btnRelatedSigns").style.visiblity = "visible"; } else { document.getElementById("btnRelatedSigns").style.visiblity = "hidden"; } })
The code counts the related signs just fine, but does not display the button as visible.
Here is my project on github with the version related to this question: csergent45/streetSigns at e8bd20b75864c14e4df56589e4f9baa03db5c053 · GitHub
Solved! Go to Solution.
Visibility is spelled wrong:
document.getElementById("btnRelatedSigns").style.visiblity
Visibility is spelled wrong:
document.getElementById("btnRelatedSigns").style.visiblity
Well, those were easy points. I kept looking for typos and kept missing it. Thanks.
This is something very common in javascript. I spend somethings hours finally to know there was a spelling mistake.
Does anyone know if there is a way to ensure all the spellings are correct.
You can copy your HTML into a word processing document and it will catch typos, but it will also think that your variable are typos. If you don't have a word processing tool, you could use something like this: JavaScript Spell Check