Are you first timer at Why not join us and start exchange your programming knowledge with everyone. Register today!

jQuery - comma on number function

0 votes
added Jun 1 in jQuery by LC Marshal Lieutenant (13,870 points)
edited Aug 29 by LC Marshal
//placed plugin globally, so it can be used globally 
$.fn.digits = function(){ 
    return this.each(function(){ 
        $(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") ); 

//to add comma on JSON object 
var areaname = $('').text(),
    lookforstate = $('ol.breadcrumb li:last-child').text(),
    trimstate = lookforstate.split(","),
    resultstate  = trimstate [trimstate.length-1],
    getstate = $.trim(resultstate),
    outlookLislnk = '',
    incDistrcRent = '&listing_type=rental&district=',
    fulloutLisRent = outlookLislnk + getstate + incDistrcRent + areaname;


Please log in or register to response this reference. - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.