Skip to content

Multiple elements will not trigger separately when event bound like this #11

@buchmayr

Description

@buchmayr

i have several input elements with the class '.validate_german_number_format' which could be added after site load.

so i added an event on body, to trigger an event of each of this inputs like this
$('body').bindWithDelay('input', '.validate_german_number_format', (evt) => testGermanNumber(evt), 1000);

the callback function works perfectly fine and the delay works as well, but:
problem is that each input element does not have its own delay. if I type something wrong in an input, then switch immediatly to another input and start typing within 1000ms, the callback will not be triggered on the first element.

is there a way to ccircumvent this, do I use it wrong? (I'm not the best in JS)
seems like the timer is reset for each "body" element only and will only trigger the callback on the last input element changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions