I have come across a strange thing which I didn't find any reference for.
In JavaScript we use document.getElementById("elem").value
to get the value of the element with the id="elem"
But I have seen some material which use elem.value
straightway to get the value of the element with the id="elem". Previously I thought its a mistake, but when I use the code it works!!
Is it a valid code? How it works??
Please clarify.