Hi All

Suprisingly it was new for me, when i was working with a core javascript code and found something very interesting there.

It was a new way DOM elements are being processed in javascript. I am not sure whether this is pure luck or something really interesting and innovating. Let me help decide this...

Problem:
It was a simple textbox like
Code:
<input type="text" id="userName" />
On a button click i just wrote like :
Code:
alert(userName.value)
and surprisingly it worked.

I am not getting how this is being treated as a DOM object. i debugged and found complete DOM object is available once we use element id as a variable in javascript.

I am not getting exact reason why it is happening and if possible how it is getting converted as a DOM object, and if its so, so what's the use of javascript/jquery left to make DOM for html elements.

kindly help me resolve this, wishing for a innovation soon

Thanks
Jatin