SHANib
SHANib

Reputation: 718

How to make an option in select box readonly not disabled using jquery?

How to make an option in select box readonly not disabled using jquery? I have a multiple select box for selecting roles and a single select primary role.

Now i want to make the selected option in primary role to automatically checked in roles multiple select box in read only mode.

Any help will be appreciated

Upvotes: 3

Views: 6139

Answers (1)

AO_
AO_

Reputation: 2874

$('select').change(function() {
    $(this)
        .siblings('select')
        .children('option[value=' + this.value + ']')
        .attr('disabled', true)
        .siblings().removeAttr('disabled');
});

Upvotes: 1

Related Questions