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

165
Visualizações
change the select input on change of other select input

i have more than 2 divs that have 2 select inputs. when i change branch_country, the other branch_region changes according to branch_country value via ajax.

<div>
   <select class="branch_country></select>
   <select class="branch_region></select>
</div>
<div>
  </elect class="branch_country></select>
  <select class="branch_region></select>
</div>

and here is my ajax code

    $('.branch_governorate_select').on('change', function(e) {
        e.preventDefault();

        console.log($(this).eq($(this)));

        var countryID = $(this).val();

        var status = $(this).parent().parent().find('.modal-body').find('#select-status-calendar')
            .val();

        var url = "{{ route('sett.doc_get_branch_region', ':id') }}";
        url = url.replace(':id', countryID);

        if (countryID) {
            $.ajax({
                url: url,
                type: "GET",
                dataType: "json",
                success: function(data) {
                    region_input.empty();
                    $.each(data, function(key, value) {
                        region_input.append('<option value="' +
                            value.id + '">' + value.name + '</option>');
                    });
                }
            });
        } else {
            region_input.empty();
        }
    });

it works well, but it changes all inputs with class branch_region. but i need to change only the branch_region select input that is inside the same div

over 4 years ago · Santiago Trujillo
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