jQuery select HTML5 text field inputs like "text", "search", "email" etc
In HTML5 there are some new input types like email, search and url. These all have a text input which could开发者_StackOverflow中文版 potentially be used with the jQuery autocomplete plugin I'm building. How do I filter all these? Must I match the element against a whitelist of these types or is there some magic way to test if an input is rendered like a text input?
Another option would be not check at all, and let the integrating developer take the crash for trying to use it on a non text input.
Might be better to make a list of inputs which doens't render like a textbox.
Since most inputs render like a textbox.
Other than that I don't think there is some magic way of knowing whether an element is rendered like a textbox.
I believe that all of the new HTML5 inputs will still have values stored as text. The "range" input wouldn't need to have autocomplete applied, but it should still work for the rest. The problem might be with your plugin getting in the way of the UI though.
Another option is to look into using Modernizr.
精彩评论