Skip to content

Instantly share code, notes, and snippets.

@devdays
Created February 23, 2015 21:16
Show Gist options
  • Save devdays/2d3a2014a98148c43336 to your computer and use it in GitHub Desktop.
Save devdays/2d3a2014a98148c43336 to your computer and use it in GitHub Desktop.
Calling the Add Method
(function ($) {
$.widget("custom.clicker", {
// Default options.
options: {
startingValue: 0,
_currentValue : 0
},
// _create and other methods to access properties ommitted ..
add: function (val) {
if (val === undefined) {
this.options._currentValue++;
} else {
this.options._currentValue += val;
}
}
});
}(jQuery));
myClicker.clicker("add");
myClicker.clicker("add", 5);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment