interval-input

1.1.0 • Public • Published

intervalInput()

jQuery plugin which allow make interval from the input. Returns number of seconds calculated from the interval.

Usage

Base:

$('#selector').intervalInput();

Changed format:

$('#selector').intervalInput({
    format: 'h[-]i[-]s'
});

Event listener:

$('#selector').intervalInput();
$('#selector').on('intervalinputchange', function(e, data) {
    // do something on change event
});

See all examples.

API

Description of the API provided by the plugin.

Options

translations

Input tooltips texts.

Default:

{
    w: 'weeks',
    d: 'days',
    h: 'hours',
    i: 'minutes',
    s: 'seconds'
}

format

Format used to generate the inputs for interval.

Available options:

  • w - weeks
  • d - days
  • h - hours
  • i - minutes
  • s - seconds

Plugin allows to pass constant between options using braces ([, ]).

Syntax:

d[days]h[:]s

This example generate following structure: <input>days<input>:<input>

Default:

d[days]h[:]i[:]s

Methods

setEnabled(enabled)

  • enabled boolean

Set enabled or disabled plugin inputs.

refresh()

Recalcualte interval values.

Events

intervalinputchange

Event triggered on change value in the any input.

Package Sidebar

Install

npm i interval-input

Weekly Downloads

1

Version

1.1.0

License

MIT

Last publish

Collaborators

  • piotrooo