E
E
eLig2018-02-07 09:57:02
JavaScript
eLig, 2018-02-07 09:57:02

jQuery UI selectmenu How to block dropdown value in another listbox?

Hello!
Can you tell me how to block the value of the dropdown list?
Suppose in the first select we select the value 5, and in the second we block the value 3.
What determines the lock is specified manually.
We have the following:

<form id="IDForm">
<select id="test1" class="ser_art" name="test1">
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
</select>
<select id="test2" class="ser_art" name="test2">
<option value="5">5</option>
<option value="4">4</option>
<option value="3">3</option>
<option value="2">2</option>
</select>
</form>

jQuery( "select" ).selectmenu();
jQuery( "#IDForm select" ).selectmenu({
  change: function( event, ui ) {		
    // тут блокировка
               // тут рефреш		
    }
});

I think I found what I need in the documentation: $( ".selector" ).selectmenu( "option", "disabled", true ); , but I can't get it to apply correctly. What should the specified function (if true) look like correctly when applied to the specified code?

UPD:
So far I have done so.
jQuery('#IDForm #test2 option[value="6"]').attr('disabled', 'disabled');
    jQuery('#IDForm #test2').selectmenu('refresh');

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question