using javascript snippet

Hi i am using javascript snippet inside i added  Jquery code to add and hide the css classes for a click function and in the  console i am getting this error  Cannot read property 'getTrackId' of null TypeError: Cannot read property 'getTrackId' of null     at t.reloadPage (http://localhost:8080/mxclientsystem/mxui/mxui.js?637249204564600836:73:279068)     at http://localhost:8080/mxclientsystem/mxui/mxui.js?637249204564600836:73:206914     at http://localhost:8080/mxclientsystem/mxui/mxui.js?637249204564600836:73:369715     at Array.forEach (<anonymous>)     at WebSocket.socket.onmessage (http://localhost:8080/mxclientsystem/mxui/mxui.js?637249204564600836:73:369687)                    Cannot read property 'classList' of undefined TypeError: Cannot read property 'classList' of undefined     at S.<computed>.E.getTab (http://localhost:8080/widgets/widgets.js?637249222742883781:8423:40)     at S.<computed>.E.selectTab (http://localhost:8080/widgets/widgets.js?637249222742883781:8454:19)     at S.<computed>.E.<anonymous> (http://localhost:8080/widgets/widgets.js?637249222742883781:8395:13)     at http://localhost:8080/mxclientsystem/mxui/mxui.js?637249222742883781:5:27280 Thanks In Advance
3 answers

Hi Narendran,

Looks like  your snippet is tries to find stuff that is not rendered yet, Add a timeout to validate that.

What about using a widget for this. for example

There are various widgets that can set style and classes.

Please be casefull setting classes on items that are conditional visible, they classes will be gone after hide and show.


Cheers, Andries



You could make use of one of the client api’s to trigger your code once the dom is completely rendered, and all data is loaded. it’s an event listener.

mx.addOnLoad(function() {

function myFunction(){
    console.log("Do something");

documentation can be found here



Hi Narendran j,

First, you need to store the jquery library inside the HTML snippet and after that, u need to add another JavaScript snippet inside it u have to write the code to avoid rendering stuff because it searches for the library.