Skip to content

onChange attribute is broken on initialization #8

@peppies

Description

@peppies

I have an element like the following, which lists 100s of countries via MySQL:

<select class="form-select" name="country" id="country" onChange="test()" data-placeholder="Anything" data-search="false" multiple data-multi-select>

When the page loads loads up and the MultiSelect initializes, the onChange="test()" seems to get lost and no longer works. The only other way to get it initialized is to manually reinitialize with the following (which I have not even tried yet):

new MultiSelect('#country', {
data ....
 onChange: test(),
});

The problem with this, is it loses all the original data, so now I have to rebuild the data array inside that reinitialize script, which is a hassle. When the page loads for the first time and MultiSelect runs automatically, it should just copy and paste whatever I have in the "onChange" attribute into the new MultiSelect instance without me having to do anything.

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