项目作者: jabranr

项目描述 :
Form fields placeholder fallback for IE using jQuery
高级语言: JavaScript
项目地址: git://github.com/jabranr/jquery.placeholderfallback.js.git
创建时间: 2014-01-30T16:31:51Z
项目社区:https://github.com/jabranr/jquery.placeholderfallback.js

开源协议:

下载


Form fields placeholders - jQuery plugin

placeholderfallback is a small jQuery plugin providing support for browsers that do not support the placeholder attribute for form fields, in particular for Internet Explorer 9 and lower, and Opera Mini 8. This plugin makes use of give placeholder attribute to set and display the values accordingly.

Install

Bower

  1. $ bower install placeholder-fallback

Usage

  • Include this plugin in your HTML:
    1. <script src="path/to/jquery.placeholderfallback.js" type="text/javascript"></script>
  • Call the method on any form field or on multiple form fields by passing them as an array.
  • Wrap this method call between IE conditional tags to make sure that it is only called when required.

Example

  1. <!doctype HTML>
  2. <html>
  3. <head>
  4. <title>Example</title>
  5. <script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
  6. <script src="bower_components/placeholder-fallback/dist/jquery.placeholderfallback.js"></script>
  7. </head>
  8. <body>
  9. <form>
  10. <input type="text" id="firstNameField" placeholder="First Name">
  11. <input type="text" id="lastNameField" placeholder="Last Name">
  12. <input type="email" id="emailField" placeholder="Email address">
  13. </form>
  14. <!--[if lt IE 10]>
  15. <script>
  16. $('#firstNameField, #lastNameField, #emailField').placeholderfallback();
  17. </script>
  18. <![endif]-->
  19. </body>
  20. </html>

Dependencies

Requires jQuery 1.8 +

License

MIT License - © Jabran Rafique

Analytics