I noticed while playing around with Chrome that both of these functions work the same:
<img src="picture.jpg" id="myelement" />
function stuff(){
var x=document.getElementById("myelement");
x.style.display="none";
}//works almost everywhere
function stuff(){
myelement.style.display="none";
}//only works in Chrome
Why does Chrome allow me access the element straight from the id without using 'getElementById'? And is it bad practice to do it this way? Does it hurt performance?
Thanks