3 ms·
Why use <input type="text" data-type="email"> rather than... <input type="email"> ? You're already using HTML5 data attributes, so why not use HTML5 input types
by adamdicarlo 14y ago
Why use <input type="text" data-type="email"> rather than... <input type="email"> ? You're already using HTML5 data attributes, so why not use HTML5 input types? Added benefit is that the browser also has an idea of what kind of data goes there - this helps on mobile devices especially, where email fields won't auto-capitalize and might include extra buttons like the ".com" button and "@" right on the normal keyboard.
- guillaumepotier 14y agoRight. jQuery/Zepto $.data() was fast and easy to implement, rather than searching html5 attr. I'll think about that ;)
- akoeberle 14y agoIt shouldn't be that hard to use a attribute instead: var data = $( self ).attr(type);