Why won't my button display after query is run?

3031
4
Jump to solution
07-07-2015 02:10 PM
ChrisSergent
Regular Contributor III

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

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
SteveCole
Frequent Contributor

Visibility is spelled wrong:

document.getElementById("btnRelatedSigns").style.visiblity

View solution in original post

4 Replies
SteveCole
Frequent Contributor

Visibility is spelled wrong:

document.getElementById("btnRelatedSigns").style.visiblity

ChrisSergent
Regular Contributor III

Well, those were easy points. I kept looking for typos and kept missing it. Thanks.

thejuskambi
Occasional Contributor III

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.

ChrisSergent
Regular Contributor III

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