jQuery Plugin To Auto Format Time Format - timepicker.js

File Size: 2.61 KB
Views Total: 10936
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Auto Format Time Format - timepicker.js

timepicker.js is a minimalist jQuery plugin converting an input field into a time picker that automatically formats and corrects timestamps in 24 hour format.

How it works:

  • Make sure first value is not greater than 2
  • Make sure second value is not greater than 4
  • Make sure that third value is not greater than 5
  • Make sure only 5 Characters can be input
  • Prevent Alpha and Special Character inputs

How to use it:

1. Download and load the jQuery timepicker.js script after you've loaded jQuery library.

<script src="//code.jquery.com/jquery-1.12.1.min.js"></script>
<script src="timepicker.js"></script>

2. Add the 'data-timepicker' attribute to the input field will auto initialize the plugin on document ready.

<input type="text" name="name" value="" placeholder="12:00" data-timepicker>

This awesome jQuery plugin is developed by jonathonwang. For more Advanced Usages, please check the demo page or visit the official website.