jQuery.fn.extend({
fillCurrency : (function() {
$this = jQuery(this);
function _usd(string1) {
$this.text("$" + parseFloat(string1).toFixed(2));
return $this;
}
return {
usd : _usd
};
})()
});
var text = 2;
jQuery("#total").fillCurrency.usd(text);
<p id="total"></p>
Tried several options and I think I have now come close. The issues is now Object [object global] has no method ‘createDocumentFragment’. Does someone know what the issue is here?
I got the solution:
This will pass the jQuery object down into the inside objects for things such as a plugin.