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>
尝试了几种选择,我想我现在已经接近了。现在的问题是 Object [object global] 没有方法“createDocumentFragment”。有人知道这里有什么问题吗?