Our form software outputs all elements with 'type="text"', but I'd rather take advantage of the new types in HTML5, such as 'email', 'number', etc.
I can add these in at the end but I end up with multiple type attributes, eg:
<input type="text" name="email" type="email">
If there is more than one 'type' attribute present for an element, which is used - the first or last? And is it valid to have more than one? I'd guess not but trying to get round this situation...
No you cannot, that will be an invalid HTML, you can safely use type="email"
instead of type="text"
, because if browser is not HTML5 capable, it will treat any unknown type attribute value
as text
And if you state something like this
<input type="text" type="email" />
Browser won't respect type="email"
Test Case
<!DOCTYPE html>
<form>
<input type="text" type="email" />
<input type="submit" value="test" />
</form>
Remove type="text"
attribute and browser will respect type="email"
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