Reputation: 138
Can the name attribute of the input of the HTML form not have the same value as the type attribute?
I found when I'm using the input's name and input's type as the same attribute, some function will no word.
Upvotes: 0
Views: 279
Reputation: 6438
The type attribute needs to be one of the valid available values, such as text or password.
The name attribute is something you define.
Possible reason why sometimes things don't work for you when they're the same value is that maybe you've given type attribute a value that's not valid for it.
For example:
<input type="coupon" name="coupon"> <!-- This won't work, type "coupon" doesn't exist -->
<input type="password" name="password"> <!-- This will work -->
<input type="text" name="coupon"> <!-- This will work -->
The second one will work, because password is a valid value for the type attribute. The first one won't work, because there's no such input type as "coupon". So that type needs to be changed to "text".
It's an easy mistake to make, so I suggest check that.
Upvotes: 1