Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

282
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!