0

i've been trying to add notification bar to my website which requires some javascript code, i added it but i'm getting error uncaught Typerror:

Uncaught TypeError: Cannot set property 'disabled' of null

My code is

<script src="js/classie.js"></script>
    <script src="js/notificationFx.js"></script>
    <script>
        (function() {
            var svgshape = document.getElementById( 'notification-shape' ),
                bttn = document.getElementById( 'notification-trigger' );

            // make sure..
            bttn.disabled = false;
            bttn.addEventListener( 'click', function() {
                // create the notification
                var notification = new NotificationFx({
                    wrapper : svgshape,
                    message : '<p>Test!</p>',
                    layout : 'other',
                    effect : 'loadingcircle',
                    ttl : 9000,
                    type : 'notice', // notice, warning or error
                    onClose : function() {
                        bttn.disabled = false;
                    }
                });

                // show the notification
                notification.show();

                // disable the button (for demo purposes only)
                this.disabled = true;
            } );
        })();

How could I make a possible workaround around this?

Mikk
  • 21
  • 6

0 Answers0