Q:

How to get element id as function parameter

I am studying as front end developer.  I am new to javascript.  And i got this problem when i execute a js from backend passing some elements id. It displays some error Cannot read property 'addEventListener' of null. 
My js:
function disableOtherCheckBoxGrpScrolls(elementsContainerId) {
   console.error("Elements id from backend: " + elementsContainerId);
   var container = document.getElementById(elementsContainerId);
   // I am checking here length of elements
   console.error("Elements length : " + container.length);
   // It displays Elements length : undefined
     container.addEventListener('mousewheel', function(e){
      if (! $(this).hasScrollBar()) return;
     // If container div has a scrollbar it will do nothing

        var event = e.originalEvent,
        d = event.wheelDelta || -event.detail;

        this.scrollTop += (d < 0 ?  1 : -1) * 30;
        e.preventDefault();  
    }, {passive: false});
}

Any solution of this ?  
And my backend passing elements id
    if (! isMobile)
        JSUtil.execFn("disableOtherCheckBoxGrpScrolls", checkboxGrp.getElementsContainerId());

A:

Guys i solved my problem :).  But i don't understand well how this working.  My solution is:
function disableOtherCheckBoxGrpScrolls(elementsContainerId) {
  console.error('containerId: ' + elementsContainerId);
  // First is element undefined or Not rendered to DOM my opinion
  (function() {
    if (typeof elementsContainerId === "undefined") {
        throw new Error("elementsContainerId parameter is undefined");
    }
    var container = document.getElementById(elementsContainerId);
    console.error("Elements ID : " + container.length);
    container.addEventListener('mousewheel', function(e) {
        if (! $(this).hasScrollBar()) return;
        // logger.debug('has scroll');

        var event = e.originalEvent,
            d = event.wheelDelta || -event.detail;

        this.scrollTop += (d < 0 ?  1 : -1) * 30;
        e.preventDefault();
     }, { passive: false });

  })();

}

And i thought maybe js worked before html elements not loaded thats i got null and undefined error.  By the way thanks for all comments and answers :).