第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在第二個“選擇”部分中選擇選項(xiàng)時,該特定選項(xiàng)不會隱藏在第一個“選擇”部分中

在第二個“選擇”部分中選擇選項(xiàng)時,該特定選項(xiàng)不會隱藏在第一個“選擇”部分中

PHP
慕田峪9158850 2023-09-22 14:29:32
如何復(fù)制問題:如果我在第一個“選擇”中選擇一個選項(xiàng),該特定選項(xiàng)將隱藏在第二個“選擇”中。但是接下來,如果我在第二個“選擇”中選擇一個選項(xiàng),新選擇的選項(xiàng)不會隱藏在第一個“選擇”中我怎樣才能做到這一點(diǎn)?每當(dāng)我選擇某些內(nèi)容時,它都應(yīng)該隱藏在其他“選擇”部分中$(function() {  var sec = $('.security');  sec.change(function() {    console.log("security change!");    let currentSelect = sec.find('option:selected').val();    $('.security option').each(function() {      var self = $(this);      if (self.val() === currentSelect) {        self.hide();      } else {        self.show();      }    });  }).change();});<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><div class="col-sm-6 form-group">  <label for="security-question-1"><span class="trn">Security Question</span> 1 *</label>  <select class="form-control security" id="security-question-1">    <option class="trn" disabled selected value>select a question</option>    <option class="trn" value="q1">What is the name of your first school?</option>    <option class="trn" value="q2">What is your favorite movie?</option>    <option class="trn" value="q3"> What is your mother's maiden name?</option>    <option class="trn" value="q4">What street did you grow up on?</option>  </select></div><div class="col-sm-6 form-group">  <label for="security-question-2"><span class="trn">Security Question</span> 2 *</label>  <select class="form-control security" id="security-question-2">    <option class="trn" disabled selected value>select a question</option>    <option class="trn" value="q1">What is the name of your first school?</option>    <option class="trn" value="q2">What is your favorite movie?</option>    <option class="trn" value="q3"> What is your mother's maiden name?</option>    <option class="trn" value="q4">What street did you grow up on?</option>  </select></div>
查看完整描述

1 回答

?
猛跑小豬

TA貢獻(xiàn)1858條經(jīng)驗(yàn) 獲得超8個贊

試試這個,也看看我的評論


$(function () {

      var sec = $('.security');

      sec.change(function () {

        let currentSelect=$(this).find('option:selected').val(); // Your code use sec.find() which is wrong since it picks the first selected option of first select.

        $('.security option').show();

        $('.security option[value="' + currentSelect + '"]').hide(); // This is shorter code.

      }).change();

  });

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div class="col-sm-6 form-group">

  <label for="security-question-1"><span class="trn">Security Question</span> 1 *</label>

  <select class="form-control security" id="security-question-1">

    <option class="trn" disabled selected value>select a question</option>

    <option class="trn" value="q1">What is the name of your first school?</option>

    <option class="trn" value="q2">What is your favorite movie?</option>

    <option class="trn" value="q3"> What is your mother's maiden name?</option>

    <option class="trn" value="q4">What street did you grow up on?</option>

  </select>

</div>


  <div class="col-sm-6 form-group">

    <label for="security-question-2"><span class="trn">Security Question</span> 2 *</label>

    <select class="form-control security" id="security-question-2">

      <option class="trn" disabled selected value>select a question</option>

      <option class="trn" value="q1">What is the name of your first school?</option>

      <option class="trn" value="q2">What is your favorite movie?</option>

      <option class="trn" value="q3"> What is your mother's maiden name?</option>

      <option class="trn" value="q4">What street did you grow up on?</option>

    </select>

  </div>


查看完整回答
反對 回復(fù) 2023-09-22
  • 1 回答
  • 0 關(guān)注
  • 127 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號