jQuery - comma for price function

0 votes
118 views
added Jun 1, 2018 in jQuery by LC Marshal Captain (25,770 points)
edited Sep 20, 2018 by LC Marshal
//comma plugin
$.fn.digits = function(){ 
    return this.each(function(){ 
        $(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") ); 
    })
}

//comma for price on listing and area summary
$('.price-listing, .count-sale').digits();
lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...