Select to view content in your preferred language

Error when attempting to use on(dom.byId....

3256
1
05-05-2015 07:20 AM
ChrisSergent
Deactivated User

When I add the following block of code:

on(dom.byId("btnCancelFeedback"), "click", function () {
        document.getElementById("feedbackModal").style.visibility = 'hidden';
    });

I receive an error as follows:

TypeError: Cannot read property 'on' of null

"in domReady callback"

"TypeError: Cannot read property 'on' of null

I have used this method in the past with no issues including inside this project, but this causes an error. Any ideas?

Here is my complete app on github:https://github.com/csergent45/streetSigns

The JavaScript is in app/main.js

1 Reply
ChrisSergent
Deactivated User

This is what ended up working:

on(dom.byId("btnCancelFeedback"), "click", function () {
        query("#feedbackModal").modal("hide");
    });

The other thing that worked is when I changed removed the double quotes from feedbackModal and replaced them with single quotes.