The111 The111 -4 years ago 65
Javascript Question

JavaScript variable name and HTML input name attribute: namespace collision?

In an HTML file I have the following:

<input type="..." name="myInput1" />


In a corresponding JS file I have the following variable which will hold the string value of that input after blur:

var myInput1;


Is there any problem in having these two identical names? I'm guessing that the namespaces are separate so it is ok.

Answer Source

Short answer, no problem whatsoever.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download