Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

283
Visualizações
How to show / hide same option from other dropdown using jQuery or Javascript

I have 4 dropdown list <td> <select class="encoderSelect" id="encoder1"><option value="None">-- Select User Command --</option><option value="1920*1080">1920*1080</option> <option value="320*240 to 1280* 720">320*240 to 1280*720</option> <option value="720*480">720*480</option> <option value="320*240 to 1920*1080">320*240 to 1920*1080</option> </select></td> there is another 3 dropdown also there id is like encoder2,encoder3 and encoder4. I want to hide a the options if it is selected in any 4 of this list. I used this code by call class name but its not worked.

$('.encoderSelect').change(function(){
        var optionval = $('.encoderSelect').val();
        console.log(optionval);
        $(".encoderSelect option[value='"+optionval+"']").hide();
        
    }); 

$('.encoderSelect').on("change", function(){
        $('.encoderSelect:selected', this).hide().siblings().show(); 
    }).trigger('change'); // this code also tried but not worked

can I implement this using class.? or I must go by using id..?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

$('#encoder1').on("change", function(){
  var selected = $('#encoder1').val();
  for (var i = 0; i<$('#encoder1').children().length; i++) {
    var element = $('#encoder1 option:eq('+i+')');
    if ($(element).text() === selected) {
      $(element).hide();
    } else {
      $(element).show();
    }
  }
});

demo

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda