function updateCounterText(textformat, fieldId, fieldValueLength, minlength, maxlength) {
        var charsLeft = Math.floor(maxlength) - fieldValueLength,
            charsUnder = minlength - fieldValueLength,
            charsOver = fieldValueLength - Math.floor(maxlength);

        if (charsLeft < 0) {
            charsLeft = 0;
        }

        if (charsUnder < 0) {
            charsUnder = 0;
        }

        if (charsOver < 0) {
            charsOver = 0;
        }

        var counterText = textformat.replace(/\[used\]/g, fieldValueLength).replace(/\[under\]/g, charsUnder).replace(/\[left\]/g, charsLeft).replace(/\[over\]/g, charsOver).replace(/\[min\]/g, minlength).replace(/\[max\]/g, maxlength);
        $('[data-charcount-for=' + fieldId + ']').html(counterText);
    }
/*
     * Updates the counter's content with correctly formatted string
     */
Updates the counter's content with correctly formatted string
Updates the counter ' s content with correctly formatted string
function updateCounterText(textformat, fieldId, fieldValueLength, minlength, maxlength) {
        var charsLeft = Math.floor(maxlength) - fieldValueLength,
            charsUnder = minlength - fieldValueLength,
            charsOver = fieldValueLength - Math.floor(maxlength);
        if (charsLeft < 0) {
            charsLeft = 0;
        }
        if (charsUnder < 0) {
            charsUnder = 0;
        }
        if (charsOver < 0) {
            charsOver = 0;
        }
        var counterText = textformat.replace(/\[used\]/g, fieldValueLength).replace(/\[under\]/g, charsUnder).replace(/\[left\]/g, charsLeft).replace(/\[over\]/g, charsOver).replace(/\[min\]/g, minlength).replace(/\[max\]/g, maxlength);
        $('[data-charcount-for=' + fieldId + ']').html(counterText);
    }
function updateCounterText ( textformat , fieldId , fieldValueLength , minlength , maxlength ) { var charsLeft = Math . floor ( maxlength ) - fieldValueLength , charsUnder = minlength - fieldValueLength , charsOver = fieldValueLength - Math . floor ( maxlength ) ; if ( charsLeft < 0 ) { charsLeft = 0 ; } if ( charsUnder < 0 ) { charsUnder = 0 ; } if ( charsOver < 0 ) { charsOver = 0 ; } var counterText = textformat . replace ( / \[used\] / g , fieldValueLength ) . replace ( / \[under\] / g , charsUnder ) . replace ( / \[left\] / g , charsLeft ) . replace ( / \[over\] / g , charsOver ) . replace ( / \[min\] / g , minlength ) . replace ( / \[max\] / g , maxlength ) ; $ ( '[data-charcount-for=' + fieldId + ']' ) . html ( counterText ) ; }
Updates the counter's content with correctly formatted string
Updates the counter ' s content with correctly formatted string