javascript - How to Disable the combobox values on selection in multiple comboboxes JQuery? -


I want to disable values ​​in combobox on selection for multiple compos boxes. As I have select , 1,2,3,4 and 5 with values ​​with a compab 1, combobox 2, combobox 3, cobobox 4. Now, if I select the value '1' from Combobox 1, then it should be disabled by all the other composites and then if I select '2' from the Kambox 2, then it will be in 'compartment 1' and 'combobox 3' 1 'should also be disabled in combobox 3.

More explicitly:

  • Combobox1 - selected - value '1'
  • combobox 2 - selected - value '2'
  • - Disabled Value - '2', '3' but 1/3/4/5 No

  • ComboBox 2 - Disabled Value - '1', '3' but 3 / 4/5 No

  • ComboBox 3 - Disabled Value - '1' 2 'But No 3/4/5

  • Cambobox 4 - Disabled Value - '1', '2', '3' but not 4/5

Edit

If the comb Box 1 is selected with the "Featured" option, then it should disable all other combobox except combobox1 and all have to reset all values ​​for the other composite value with 0 index

but the code What is happening with, when I select the value 1 from the combobox it is disabled for the Cumbox 2 and 3, but when selecting the value '2' from Combobox 2, the value '1' becomes ComboBox3 enabled. is.

HTML Code:

  & lt; Head & gt; & Lt; Title & gt; Language test page & lt; / Title & gt; & Lt; Script src = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Choose name = "g1" id = "select_g1" & gt; & Lt; Option value = "selection1" & gt; Select & lt; / Options & gt; & Lt; Option value = "one" & gt; A & lt; / Options & gt; & Lt; Option value = "two" & gt; Two & lt; / Options & gt; & Lt; Option value = "three" & gt; Three & lt; / Options & gt; & Lt; / Select & gt; & Lt; Choose name = "g2" id = "select_g2" & gt; & Lt; Option value = "select2" & gt; Select & lt; / Options & gt; & Lt; Option value = "one" & gt; A & lt; / Options & gt; & Lt; Option value = "two" & gt; Two & lt; / Options & gt; & Lt; Option value = "three" & gt; Three & lt; / Options & gt; & Lt; / Select & gt; & Lt; Select name = "g3" id = "select_g3" & gt; & Lt; Option value = "selection3" & gt; Select & lt; / Options & gt; & Lt; Option value = "one" & gt; A & lt; / Options & gt; & Lt; Option value = "two" & gt; Two & lt; / Options & gt; & Lt; Option value = "three" & gt; Three & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

JQuery code:

  & lt; Script & gt; $ (Document) .ready (function () {$ ('select'). ('Change', function (e) {$ ('select option') .pop ('disabled', false); var optionssect = $ ( "Option: selected", this); var value selected = this.value; $ ("Select the option: in it (" + + value select + "')' '). Each (function () {if (value selected === this value) {this.disabled = true;} else {this.disabled = false;}});}}}};  / script>  

Any help is appreciated.

In other "selection" this passive D option

  $ (document () () ($ ("select"). $ ("Select"). Change (function (e) {var id = $ (this) .at Tr ("id"); var value = this.value; $ ("select option" (ed! = Idpto) {if (this.value == value) {this.disabled = true;}}}}})} );  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -