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

115
Visualizações
Correctly Implementing selectMapping with Selectrix

Quick question, struggling with the Selectric implementation on our Autofill function...

can someone give me a quick pointer on how the correct syntax looks like?

var select = document.getElementById("selectAddress"),
                    street = document.getElementById("streetInput"),
                    city = document.getElementById("cityInput"),
                    postal = document.getElementById("postalInput"),
                    state = document.getElementById("stateInput");
                    country = document.getElementById("countryInput")
                    language = document.getElementById("language")
                    apiForm = document.getElementById("apiform")

                    console.log(apiForm)
                    
                var mapping = {
                    "1": { 'sampleStreet': "Heilsbronner Strasse 4", 'sampleCity': "Neuendettelsau", 'samplePostal': "91564", 'sampleState': "Bayern", 'sampleCountry': "de" },
                    "2": { 'sampleStreet': "1600 Pennsylvania Avenue", 'sampleCity': "Washington", 'samplePostal': "20500", 'sampleState': "Washington D.C.", 'sampleCountry': "us" },
                    "3": { 'sampleStreet': "Champ de Mars 5 Av. Anatole", 'sampleCity': "Paris", 'samplePostal': "75007", 'sampleState': "Paris", 'sampleCountry': "fr" },
                    "4": { 'sampleStreet': "1 Queen's Rd W", 'sampleCity': "Hong Kong", 'samplePostal': "Neuendettelsau", 'sampleState': "Hong Kong", 'sampleCountry': "hk" },
                };

                select.addEventListener("change", function () {
                    var selectedMapping = mapping[select.value];

                    if (selectedMapping) {
                        street.value = selectedMapping.sampleStreet;
                        city.value = selectedMapping.sampleCity;
                        postal.value = selectedMapping.samplePostal;
                        state.value = selectedMapping.sampleState;
                        $(country.value(selectedMapping.sampleCountry)).selectric("refresh");
                    } else {
                        street.value = 
                        city.value = 
                        postal.value = 
                        state.value =
                        postal.value = null
                        $(country.val(null).selectric("refresh"));
                    }
                });
about 4 years ago · Juan Pablo Isaza
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