javascript - How to disable all options from all menu that have the same value jQuery -


I have a form where I have multiple drop down menus on the same page. All these menus have the same class name (i.e.clientMenu). The only options in the menu are the exact options (i.e. blue, yellow, white, black and green).

If I have 10 menus, then if the user selects "blue" on any menu then "blue" should be disabled from the other 9 menu, therefore, "blue" has only one menu Can be selected in.

This is what I have tried, but it is not working. When I say that it is not working, I mean that it is not disabling any option.

How can I make this code work?

Thanks a bunch in advance

 ($ ('.clientMenu')). (Function () ($ {"clientMenu" option). Each (function () {if ($ (this) .val () == $ (".clientmenu") .val ()) $ (this). 'Disabled', true); and $ (this) .prop ('incompetent', wrong);});});   

Edit I have made JSFDial to make things easier

< P>
  function setOptionsDisabled ($ parent, val, disabled) {$ parent.find ('option [value =' '+++} If you can definitely reduce it, Prop ('disabled', false);} $ ('Clientmenu'); Prop ('disabled', disabled); $ Parent.find ('option [value =' 0 ']'). Change (function () {$ other = $ ('client menu'). (Not this); set option disabled ($ others, $ (this) .val (), true); setOptesDiscised ($ others, $ ( This). Data ('Wall'), Uti); $ (this) Kdeta ( 'VAL', $ (this) .val ());});   



Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -