Basic Time Input Plugin For jQuery - Fugit
File Size: | 43.1 KB |
---|---|
Views Total: | 4312 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
Fugit is a small jQuery plugin that converts the standard input field into a user-friendly time selector. Your users are able to quickly select and change hours/minutes values with keyboard.
How to use it:
1. Install & Download the Fugit via NPM:
# Yarn $ yarn add jquery-fugit # NPM $ npm install jquery-fugit --save
2. Import the jQuery Fugit into your web page.
// ES 6 import Fugit from 'jquery-fugit'; // CommonJS: const Fugit = require('jquery-fugit');
<!-- Browser --> <link rel="stylesheet" href="dist/jquery.fugit.css"> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"> </script> <script src="dist/jquery.fugit.js"></script>
3. Create a normal input field for the time selector.
<input id="fugit">
4. Set the initial time if needed.
<input id="fugit" value="11:20">
5. Call the function on the input field to initialize the time selector.
$(function() { $('#fugit').fugit(); });
6. The plugin provides an event which will be fired on each change.
$(function() { $('#fugit').fugit().on('change.fugit', function(e) { console.log('value changed to', $(e.currentTarget).val()); }); });
Changelog:
2019-07-09
- v0.5.0: read from default input value, if available
2018-01-27
- v0.4.0
This awesome jQuery plugin is developed by timgthomas. For more Advanced Usages, please check the demo page or visit the official website.