最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to use Modernizr for input type=datetime? - Stack Overflow

programmeradmin0浏览0评论

I made a custom build for HTML input fields & attributes and included that on my page in the <head> but that's not working. What else do I need to do?

I made a custom build for HTML input fields & attributes and included that on my page in the <head> but that's not working. What else do I need to do?

Share Improve this question edited Aug 25, 2011 at 21:19 ztatic asked Aug 25, 2011 at 20:51 ztaticztatic 1,1814 gold badges14 silver badges21 bronze badges 5
  • I answer both of these questions above.. but I'll repeat myself for you.. – ztatic Commented Aug 25, 2011 at 20:56
  • "What have I tried" I made a custom modernizr build and added it to my page. That is all. Period. Clear? – ztatic Commented Aug 25, 2011 at 20:57
  • "What do I want to do" I want a polyfill or alternative for the html5 input type=datetime setup when it is not natively available. Clear? – ztatic Commented Aug 25, 2011 at 20:58
  • 1 Yes, I downloaded the script they gave me modernizr.custom.66777.js and added it to the head. Why would it matter if I added it this way or by copying and pasting it into a script tag? (ie: why are you asking me this?) – ztatic Commented Aug 25, 2011 at 21:19
  • It should not matter, I am just trying to figure out the problem of why it doest not work as you do not show any code. But if you added it this way it could be another problem then, either way i will just delete my ments... – Yet Another Geek Commented Aug 25, 2011 at 21:21
Add a ment  | 

1 Answer 1

Reset to default 8

Not sure what it is you are trying to acplish, but the "Input Attributes" option adds tests for the following <input> attributes: autoplete, autofocus, list, placeholder, max, min, multiple, pattern, required, and step. -- Not sure what this has to do with <input type="datetime" ...> elements?

The "Input Types" option does adds tests for the following types of <input> elements: search, tel, url, email, datetime, date, month, week, time, datetime-local, number, range, and color.

However, from the documentation:

These (input) types can enable native datepickers, colorpickers, URL validation, and so on. If a browser doesn’t support a given type, it will be rendered as a text field. Modernizr cannot detect that date inputs create a datepicker, the color input create a colorpicker, and so on—it will detect that the input values are sanitized based on the spec.

In general, Modernizr doesn't "do" anything (besides the HTML5 shim), it just allows you to detect for the existence of modern features on the browser.

发布评论

评论列表(0)

  1. 暂无评论