I have the following lines in my .js file canvas.js in my RoR /assets/javascripts/ directory. 
var b_canvas = document.getElementById("prof_canvas");
console.log(b_canvas);
Which when executed in my browser's console returns.
null
But when I write the following in the Console:
$("#prof_canvas")
I get back the <canvas> object. 
Here is the HTML upon which the JS operates:
 <canvas id='prof_canvas' style='width:400px;height:300px '></canvas>
 
     
    