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

105
Visualizações
Jquery change iframe select option texts

Change iframe select options text isn't working and I can't figure out why. JSFiddle

First block of code changes select options successfully

//when page loads 
setTimeout(function() {           
      var iframePreLoad = $("#product-component-1631134480393").children().contents();
      iframePreLoad.find(".shopify-buy__option-select__select").ready(function(){
        iframePreLoad.find('select[name=Color] option:nth-child(1)').html('Black');        
        iframePreLoad.find('select[name=Color] option:nth-child(2)').html('Green');
      });  
}, 3000);

Second block of code is supposed to change the text when the select box is interacted with. Example when one of the options are selected, the text for both options should change but it's not working.

//When selection is made  
$("#product-component-1631134480393").on('load', function() {
    $("#product-component-1631134480393").children().contents().find("select[name=Color]").on('change', function() {
        $('select[name=Color] option:nth-child(1)').html('Black');        
        $('select[name=Color] option:nth-child(2)').html('Green');
      console.log('selection changed');
    });
});  
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