1. Introduction
YearPicker is a lightweight jQuery plugin for year picker. The plugin can be attached to any input element on the website and fires when the user focuses a cursor in that specific field. Year picker pops up just like calendar picker with the only year to select. Users can navigate years with next/prev buttons and choose the specified year. YearPicker is easy to customize with CSS and integrate, it also comes with many configuration options.
2. Plugin Overview
Library | Year Picker |
Author | Saravanan |
Licence | MIT Licence |
Repository | GitHub |
Dependencies | jQuery 1.3.1 or Latest version and Moment.js 2.24.0 |
3. How to install and use YearPicker jQuery plugin
Follow below steps to install YearPicker plugin.
1. first of all install jQuery and Moment.js libraries into your HTML document
2. next, include YearPicker‘s CSS and JavaScript files
3. create HTML input field with yearpicker
class
3. initialize YearPicker plugin with selector pointed to given class name
YearPicker plugin, after initialization will handle focus event on selected input
field and present popup with year list.
4. Conclusion
In this article, we presented a jQuery plugin YearPicker used to select the year in popup attached to the specified input field. The plugin is fully customizable with CSS styles and comes with several options. You can provide the starting and ending year, an initial year or auto-hiding after selection.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}