CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   DOM and JSON scripting (http://www.codingforums.com/forumdisplay.php?f=15)
-   -   New Way to Access DOM (http://www.codingforums.com/showthread.php?t=261388)

jatinkindra 05-15-2012 02:12 PM

New Way to Access DOM
 
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

abduraooft 05-15-2012 02:37 PM

(Un)fortunately it's just an IE bug! See http://webbugtrack.blogspot.in/2007/...lution-in.html

jatinkindra 05-15-2012 02:42 PM

Thanks for your response.

But i am just wondering i checked it will all browsers namely IE, Chrome and FF. It worked same in all..


All times are GMT +1. The time now is 06:46 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.