I am trying to make a js function called _ so every time I need to type getElementById I can just put _ instead. I am trying to test it out, so I want to print "this is some data". On the console in developer tools it has this error:
Uncaught TypeError: Cannot set properties of null (setting 'innerHTML')
at (index):170:25
Here is my javascript code:
function _(element){
return document.getElementById(element);
}
var inner_pannel = _("inner_left_pannel");
inner_pannel.innerHTML = "this is some data";
Here is some html so you understand what inner_left_pannel is.
<div id="inner_left_pannel">
</div>