Jomol John Jomol John - 10 months ago 48
jQuery Question

Disable options in drop-down if selected value matches using jquery

I have a drop-down list which contains duplicated values. Now i want to disable the options, which matches to the selected value.

Answer Source

using .prop('disabled',true); element can be disabled. Please check below snippet to get idea how to make all other options with same value can make disabled.

<script src=""></script>
<select id="duplicate">
  <option value="">select</option>
  <option value='1'>1</option>
  <option value='2'>2</option>
  <option value='1'>1</option>
  <option value='1'>1</option>
  <option value='3'>3</option>
  <option value='4'>4</option>
  <option value='3'>3</option>