function initCounter(element, textformat, fieldId, fieldValueLength, minlength, maxlength, blockextra, alertclass, onOutOfRange, onBackToRange){
        fieldValueLength = countTextLength(element);
        if (blockextra === true && maxlength > 0 && fieldValueLength > maxlength) {
            fieldValueLength = maxlength;
            removeExtraText(element, maxlength);
        }

        var counterElement = $('[data-charcount-for=' + fieldId + ']');

        if ((maxlength > 0 || minlength > 0) && (fieldValueLength > maxlength || fieldValueLength < minlength)) {
            counterElement.data('charcount-outofrange', 'true');
            if (alertclass != ''){
                counterElement.addClass(alertclass);
            }
            
            onOutOfRange(fieldValueLength, minlength, maxlength);
        }
        else {
            if (counterElement.data('charcount-outofrange') === 'true'){
                counterElement.removeData('charcount-outofrange');
                onBackToRange(fieldValueLength, minlength, maxlength);
            }
            if (alertclass != '') {
                counterElement.removeClass(alertclass);
            }

            
        }

        updateCounterText(textformat, fieldId, fieldValueLength, minlength, maxlength);
    }
/**
     * Function that calls other functions to initialize and update the counter's content as well as
     * remove characters from element when maxlength has been reached
     */
Function that calls other functions to initialize and update the counter's content as well as
remove characters from element when maxlength has been reached
Function that calls other functions to initialize and update the counter ' s content as well as remove characters from element when maxlength has been reached
function initCounter(element, textformat, fieldId, fieldValueLength, minlength, maxlength, blockextra, alertclass, onOutOfRange, onBackToRange){
        fieldValueLength = countTextLength(element);
        if (blockextra === true && maxlength > 0 && fieldValueLength > maxlength) {
            fieldValueLength = maxlength;
            removeExtraText(element, maxlength);
        }
        var counterElement = $('[data-charcount-for=' + fieldId + ']');
        if ((maxlength > 0 || minlength > 0) && (fieldValueLength > maxlength || fieldValueLength < minlength)) {
            counterElement.data('charcount-outofrange', 'true');
            if (alertclass != ''){
                counterElement.addClass(alertclass);
            }
            onOutOfRange(fieldValueLength, minlength, maxlength);
        }
        else {
            if (counterElement.data('charcount-outofrange') === 'true'){
                counterElement.removeData('charcount-outofrange');
                onBackToRange(fieldValueLength, minlength, maxlength);
            }
            if (alertclass != '') {
                counterElement.removeClass(alertclass);
            }
        }
        updateCounterText(textformat, fieldId, fieldValueLength, minlength, maxlength);
    }
function initCounter ( element , textformat , fieldId , fieldValueLength , minlength , maxlength , blockextra , alertclass , onOutOfRange , onBackToRange ) { fieldValueLength = countTextLength ( element ) ; if ( blockextra === true && maxlength > 0 && fieldValueLength > maxlength ) { fieldValueLength = maxlength ; removeExtraText ( element , maxlength ) ; } var counterElement = $ ( '[data-charcount-for=' + fieldId + ']' ) ; if ( ( maxlength > 0 || minlength > 0 ) && ( fieldValueLength > maxlength || fieldValueLength < minlength ) ) { counterElement . data ( 'charcount-outofrange' , 'true' ) ; if ( alertclass != '' ) { counterElement . addClass ( alertclass ) ; } onOutOfRange ( fieldValueLength , minlength , maxlength ) ; } else { if ( counterElement . data ( 'charcount-outofrange' ) === 'true' ) { counterElement . removeData ( 'charcount-outofrange' ) ; onBackToRange ( fieldValueLength , minlength , maxlength ) ; } if ( alertclass != '' ) { counterElement . removeClass ( alertclass ) ; } } updateCounterText ( textformat , fieldId , fieldValueLength , minlength , maxlength ) ; }
Function that calls other functions to initialize and update the counter's content as well as
 remove characters from element when maxlength has been reached
Function that calls other functions to initialize and update the counter ' s content as well as remove characters from element when maxlength has been reached