Skip to content

After create new option, the order doesn't is kept #42

@intropedro

Description

@intropedro

I have this select:

<select id="myselect" name="test" multiple="multiple">
    <option value="40">A</option>
    <option value="75">B</option>
    <option value="41">C</option>
    <option selected="selected" data-bsm-order="1" value="29">D</option>
    <option value="39">E</option>
    <option value="23">F</option>
    <option selected="selected" data-bsm-order="0" value="44">G</option>
    <option value="62">H</option>
    <option value="38">I</option>
    <option value="61">J</option>
</select>

And the Javascript:

jQuery("#myselect").bsmSelect({
    addItemTarget: 'original',
    plugins: [jQuery.bsmSelect.plugins.sortable(), jQuery.bsmSelect.plugins.compatibility()]
});

The select is showed in the correct order. Then I change the order and after I add an option:

var option = jQuery("<option>", { text: 'NEW', selected: "selected"});
    jQuery("#myselect").append(option).change();

But the order of the options is changed to the initial and not to the last order.

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