|
|
|
|
|
by locci
5264 days ago
|
|
I tend to use document.forms['foo'].elements['bar'], here's why: I use the elements collection because the behaviour of adding each input as a property to the parent form element is a mistake. I use the bracket notation because it highlights the difference between the implementation symbols and the actual data which is being manipulated. What I mean is that I see a property specified with the dot notation on the same level as an identifier and as such its name is just to remind us humans of its purpose, whereas a property accessed using bracket notation is important both to us and to the program since it specifies a data point. |
|