I am trying to disable all options in all select boxes with specific value on page.
If there are 5 select boxes and each have 4 options. Like this:
<select> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> <select> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> <select> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> </select> I want to disable all options with value 3 on whole page, how would i achieve this?
$("select option["+previous+"]").attr('disabled', 'disabled'); But this is disabling Select option with selected value 3.
Any help will be appreciated.
previouscoming from?"select option[value='"+previous+"']"?$("select option[value="+previous+"]").prop('disabled', true);var previous = 3; $('select option') .filter(function(i, e) { return $(e).val() == previous }) .prop('disabled', true);