Thursday, November 21

DOM Scripting with Mozillia: Name and ID conflicts

0

If you are scripting with the DOM in mozilla browsers, and probably with IE browsers as well, you should never name your elements the same as your id. example:

Bad:

<input name="key" id="key" />

Good:

<input name="key1" id="key2" />

If you gvie the elements name attribute and id attribute the same value, then the DOM gets confused and returns nothing. And now you know!

Share.

Comments are closed.