Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions jquery.priceformat.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

var options = $.extend(true, {}, $.fn.priceFormat.defaults, options);

if (typeof options.callback == 'function') {
options.callback(this);
}

// detect if ctrl or metaKey(Mac) is pressed
window.ctrl_down = false
var metaKey = false
Expand Down Expand Up @@ -50,6 +54,8 @@

// load the pluggings settings
var prefix = options.prefix;
var afterMethod = options.afterMethod;
var afterMethodParams = options.afterMethodParams;
var suffix = options.suffix;
var centsSeparator = options.centsSeparator;
var thousandsSeparator = options.thousandsSeparator;
Expand Down Expand Up @@ -100,6 +106,7 @@
}
}


return formatted;
}

Expand Down Expand Up @@ -174,6 +181,7 @@
// apply the suffix
if (suffix) formatted = formatted + suffix;


return formatted;
}

Expand Down Expand Up @@ -234,6 +242,20 @@
if (str != price) set(price);
var format = price_format('0', true);
if (price == format && str != '0' && clearOnEmpty) set('');

//method to run after pricing
//afterMethod();
if (afterMethod){
if (afterMethodParams){
if (afterMethodParams == 'self'){
afterMethod(obj);
} else {
afterMethod(afterMethodParams);
}
} else {
afterMethod();
}
}
}

// Add prefix on focus
Expand Down Expand Up @@ -330,6 +352,7 @@
* Price to Float *
******************/
$.fn.priceToFloat = function() {
var field;

var field;

Expand All @@ -352,6 +375,8 @@
limit: false,
centsLimit: 2,
clearPrefix: false,
afterMethod: '',
afterMethodParams: '',
clearSufix: false,
allowNegative: false,
insertPlusSign: false,
Expand Down
3 changes: 2 additions & 1 deletion jquery.priceformat.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.