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

110
Views
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
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!