Countable.js
function (elements, callback, options) {
      if (!validateArguments(elements, callback)) return

      if (!Array.isArray(elements)) {
          elements = [ elements ]
      }

      each.call(elements, function (e) {
          const handler = function () {
            callback.call(e, count(e, options))
          }

          liveElements.push({ element: e, handler: handler })

          handler()

          e.addEventListener('input', handler)
      })

      return this
    }
function (elements, callback, options) {
      if (!validateArguments(elements, callback)) return

      if (!Array.isArray(elements)) {
          elements = [ elements ]
      }

      each.call(elements, function (e) {
          const handler = function () {
            callback.call(e, count(e, options))
          }

          liveElements.push({ element: e, handler: handler })

          handler()

          e.addEventListener('input', handler)
      })

      return this
    }
function ( elements , callback , options ) { if ( ! validateArguments ( elements , callback ) ) return if ( ! Array . isArray ( elements ) ) { elements = [ elements ] } each . call ( elements , function ( e ) { const handler = function ( ) { callback . call ( e , count ( e , options ) ) } liveElements . push ( { element : e , handler : handler } ) handler ( ) e . addEventListener ( 'input' , handler ) } ) return this }
The `on` method binds the counting handler to all given elements. The
event is either `oninput` or `onkeydown`, based on the capabilities of
the browser.

@param   {Nodes}     elements   All elements that should receive the
Countable functionality.

@param   {Function}  callback   The callback to fire whenever the
element's value changes. The callback is
called with the relevant element bound
to `this` and the counted values as the
single parameter.

@param   {Object}    [options]  An object to modify Countable's
behaviour.

@return  {Object}    Returns the Countable object to allow for chaining.
The on method binds the counting handler to all given elements . The event is either oninput or onkeydown based on the capabilities of the browser .