Receiving Error Message: "Uncaught TypeError: Cannot read property 'focus' of null" when trying to call focus() to an element ID
That because javascript can't find any element with id='#myEl'
, remove the extra #
in :
document.getElementById('#myEl').focus();
_________________________^
Or use jquery selector instead :
$('#myEl').focus();
Hope this helps.