UPDATE 24/08/2010: Various fixes and updates have now been incorporated, and the instructions below have been updated.

SmartRedFox is pleased to announce it’s first ever jQuery plugin – the Totaliser.

It’s a simple plugin that takes a text box and turns it into a fruit machine style number updater. It’s easier to see than explain, so take a look at the demo.

There are a couple of things you need to know to use it:

1> Include the js file after your jquery include:

<script type=”text/javascript” src=”YOURPATHHERE/jquery.totaliser.js”></script>

2> Call the totaliser against a textbox to create it:

$(‘#textboxid’).totaliser();

3> When you want to update it just call UpdateTotaliser with a new number:

$(‘#textboxid’).totaliser(45545666);

or

$.fn.totaliser(45545666);

There are a few configurable options for the totaliser:

  • digits – this sets how many digits the totaliser displays (default is 9)
  • currency – set this to false if you don’t want to show the currency symbol
  • currencySign – this sets what currency symbol shows before the number (default is british pounds).

So for example to load it up with the dollar sign and only 6 digits you’d call the following:

$(‘#textboxid’).totaliser({digits:6,currencySign:”$”});

Download Totaliser View demo
If you have any bugs, suggestions, improvements, or just want to let me know that you’re using it, please leave a comment.

[ad#ad-3]