Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled state #15

Open
morphsteve opened this issue Mar 26, 2014 · 0 comments
Open

Disabled state #15

morphsteve opened this issue Mar 26, 2014 · 0 comments

Comments

@morphsteve
Copy link
Contributor

Add a class (to .select-target?) and disable the control if the underlying select element is disabled.

Currently using the following workaround:

$('select').each(function() {

    var $this = $(this),
        select = new Select({el: this});

    select.disable = function() {
        $this.prop('disabled', true);
        $this.siblings('.select-target').addClass('select-target-disabled');
    };

    select.enable = function() {
        $this.prop('disabled', false);
        $this.siblings('.select-target').removeClass('select-target-disabled');
    };

    select.on('open', function() {
        if($this.prop('disabled')) {
            select.close();
        }
    });

    if($this.prop('disabled')) {
        select.disable();
    }

});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant