JQ实现三个Select下拉框互斥
生活随笔
收集整理的這篇文章主要介紹了
JQ实现三个Select下拉框互斥
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
目的:三個select下拉框中的內容相同,當其中一個下拉框選中了其中一個值后,隱藏掉另外兩個下拉框中相同的值。
html:
js:
<script>//下拉框聯動互斥$('.selectaccount?select').change(function?()?{var?strchecked?=?new?Array();$('.selectaccount?select').each(function?()?{strchecked[$(this).index()]?=?$(this).val();});//console.log(strchecked);$(this).siblings().find('option').each(function?()?{if?(($(this).attr('value')?==?strchecked[0]?||?$(this).attr('value')?==?strchecked[1]?||?$(this).attr('value')?==?strchecked[2])?&&?($(this).index()?!=?0?&&?$(this).attr('value')?!=?$(this).parents('select').val()))?{$(this).hide();}?else?{$(this).show();}});}); </script>轉載于:https://my.oschina.net/wsyblog/blog/666588
總結
以上是生活随笔為你收集整理的JQ实现三个Select下拉框互斥的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: MySQL ERROR 1045 (28
- 下一篇: Codewars-Javascript训