formcycle 8.3.6 - JavaScript for forms
    Preparing search index...

    Interface InputElementCounter

    The entry point for the character counter. It adds a simple character to input and textarea elements.

    interface InputElementCounter {
        destroy: (elements: TElementSpecifier<HTMLElement>) => void;
        init: (
            elements: TElementSpecifier<HTMLElement>,
            options?: Partial<InputElementCounterSettings>,
        ) => void;
        isInitialized: (elements: TElementSpecifier<HTMLElement>) => boolean;
        update: (elements: TElementSpecifier<HTMLElement>) => void;
    }
    Index

    Properties

    destroy: (elements: TElementSpecifier<HTMLElement>) => void

    Removes the character counter from an input or text area element. You must have called init before you call this method.

    Type declaration

    init: (
        elements: TElementSpecifier<HTMLElement>,
        options?: Partial<InputElementCounterSettings>,
    ) => void

    This function initializes an input or textarea element with a character counter that keep tracks of how many characters the users has entered.

    Type declaration

    isInitialized: (elements: TElementSpecifier<HTMLElement>) => boolean

    Checks whether a character counter was initialized for the first given input or textarea via init.

    Type declaration

      • (elements: TElementSpecifier<HTMLElement>): boolean
      • Parameters

        Returns boolean

        Whether a character counter was already initialized.

    update: (elements: TElementSpecifier<HTMLElement>) => void

    Update the counter for an input or textarea that was added via init. Normally this is not required as the counter updates automatically, but sometimes you may need to do this manually, e.g. when setting the value of the counter manually via script.

    Type declaration