当我尝试使用“ virtualkeyboard”类调用“ focusout” jquery时,jquery不调用addThousandSeparator的功能
function addThousandSeparators(nStr) {
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ' ' + '$2');
}
return x1 + x2;
}
$(document).on("focusout", ".virtualkeyboard", function(){
addThousandSeperators(this);
});
<%= f.text_field :customer_price_estimation, :class => "form-control virtualKeyboard w150"%>