Earlier, I was creating a form and mindlessly named one of my inputs "name", similar to the following pseudo code:
<input id="name" type="text" name="name" />
I then remembered that in the past, I've had issues with inputs with the name "action." If I remember correctly, the issues arose during enhancement with JavaScript (there was confusion between the form's action and the input with the name "action").
So my questions are:
There's mostly problems if you're using shortcuts like myform.action
as action
is a property of the form
element (like are id
, parentNode
, and some other properties you can see using console.dir(myform)
).
You should always use the fast and reliable way :
var inputElement = document.getElementById('action');
or, using jQuery :
var $input = $('#action');
As noticed by epascarello, you'll also have problem if you call or use a property that you overrided by defining an element with that name, for example submit
. But as you're the one calling it in your code, it should be obvious if it happens.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With