神刀安全网

Key controlled time duration and validation including rollover for form input

timepoint-selection

npm install timepoint-selection var selection = require('timepoint-selection');

Enhance input elements with easy key entry and validation for time durations.

Library is in pure javascript, no framework is needed. Event handlers are added directly to the input and the package includes a destroy method to remove all added events.

  • Input numbers directly or increment and decrement with up and down arrow keys.
  • Left and right arrow keys navigate through the input selecting the next important character for entry.
  • Rollover is automatically handled.
  • Tabbing into an element automatically selects the first character in the input for easier entry.
  • Non-valid characters are prevented from input.
  • Can provide custom separators for display.

selection(document.getElementById("ex1"));

selection(document.getElementById("ex2"), {   'durationFormat': 'hh:mm:ss',   'max': 3600 * 24,   'useAbbr': true,   'abbr': {       'hh': 'h ',       'mm': 'm ',       'ss': 's'   } });

selection(document.getElementById("ex3"), {   'durationFormat': 'hh:mm',   'value': 3600 * 2 + 60 * 30,   'useAbbr': true });

selection(document.getElementById("ex4"), {   'durationFormat': 'hh:mm',   'max': 3600 * 12 });

selection(document.getElementById("ex5"), {   'durationFormat': 'dd:hh:mm:ss',   'useAbbr': true,   'abbr': {     'dd': 'days ',     'hh': 'h ',     'mm': 'm ',     'ss': 's'   } });

selection(document.getElementById("ex6"), {   'durationFormat': 'dd:hh:mm' });

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Key controlled time duration and validation including rollover for form input

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址