Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (41 sloc) 1.11 KB

jQuery Increment/Decrement Plugin

This plugin allows you to easily increment and decrement values with jQuery.


We’ll use this HTML as a base for all the following examples:

    <script src='/javascripts/jquery.increment-decrement.js' type='text/javascript'></script>
    <div id="counter">0</div>

Incrementing values


Decrementing values


Getting current value


Custom increment/decrement step

You can increment or decrement by any value you desire:

// Increment counter by 10

Listening to increment/decrement events

$('#counter').bind('increment', function(event, counter, value) {
  console.log('Incremented ' + counter + ' ' +  value);
$('#counter').bind('decrement', function(event, counter, value) {
  console.log('Decremented ' + counter + ' ' + value);
Something went wrong with that request. Please try again.