jquery - Selecting .not(this) not working -
I have a few select lists which are all the same content, I want to be when one option is selected in one It will be disabled in others.
& lt; Div class = "social-option" & gt; & Lt; Gt selection and; & Lt; Option selected = "selected" value = "facebook" & gt; Facebook & lt; / Option & gt; & Lt; Option value = "0" & gt; & Lt; / Options & gt; & Lt; Option value = "Twitter" & gt; Twitter & lt; / Option & gt; & Lt ;! - If I choose it - & gt; & Lt; Option value = "linked" & gt; Linked & lt; / Options & gt; & Lt; Option value = "Instagram" & gt; Instagram & lt; / Option & gt; & Lt; Option value = "Flickr" & gt; Flickr & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt; & Lt; Div class = "social-choice" & gt; & Lt; Gt selection and; & Lt; Option selected = "selected" value = "facebook" & gt; Facebook & lt; / Option & gt; & Lt; Option value = "0" & gt; & Lt; / Options & gt; & Lt; Option value = "Twitter" & gt; Twitter & lt; / Option & gt; & Lt ;! - Then it is disabled - & gt; & Lt; Option value = "linked" & gt; Linked & lt; / Options & gt; & Lt; Option value = "Instagram" & gt; Instagram & lt; / Option & gt; & Lt; Option value = "Flickr" & gt; Flickr & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt; & Lt; Div class = "social-choice" & gt; & Lt; Gt selection and; & Lt; Option selected = "selected" value = "facebook" & gt; Facebook & lt; / Option & gt; & Lt; Option value = "0" & gt; & Lt; / Options & gt; & Lt; Option value = "Twitter" & gt; Twitter & lt; / Options & gt; & Lt ;! - and it is also disabled - & gt; & Lt; Option value = "linked" & gt; Linked & lt; / Options & gt; & Lt; Option value = "Instagram" & gt; Instagram & lt; / Option & gt; & Lt; Option value = "Flickr" & gt; Flickr & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt; Line Use it:
$ ('Select Social Options'). ('Change', function) (var newselected = $ ('option: selected', this) .val (); var newSelectedSiblings = $ ('Select social option'). ("Option [value =" + new] Select + "]"); Newly selected siphonings (not). (Each) function () {// here .not selector which $ (this) .attr ('disabled', 'disabled');})}} } Does not work; A ???? Any ideas why? Besides, when I this : Var newSelectedSiblings = $ ('' if you replace the selector, then why does not this line work. Select social option. Rin '). ("Option [value =" + new selection + "]"); like this:
var newSelectedSiblings = $ ( This code is the same as the change selector: $ (the "option [value =" + new select + "]"); Select 'Social Options'). ('Change' ... ...
Update I The first question has been found to have a solution: instead of newly selected sibbings.Note (this) I have used:
Newly selected jokes.Note ('Options: Chosen
I siblings () I use the function. What does this make you feel like this: $ (this) .siblings (). Each (function () {$ (this) .attr ('disabled', 'disabled');}); No () function is not working because jQuery is strange when it is compared: $ ( This) == $ (this) // false return
Comments
Post a Comment