I have a CMS that multiple people administer. We enable/disable some of our shipping methods depending on the time of year. I want to setup our checkout page to display a different message in our pickup info TD if someone enables the “Text Reserv. Pick-up” shipping option, but leave it as the default if not.
I’ve found plenty of examples to change a div or something else if an option is selected, but I just want to see if an option is in the list and then change the content of a TD based on that. I’ve tried modified of those examples to see if it will work for my situation, but haven’t got it to work.
I already have the code to change the TD, but can’t figure out how to check to see if the select contains a certain option first. Here’s the code I have to change the text and input button of the TD:
// Change description from "To pick up at the bookstore" on Step 2 of checkout to Reserve Your Textbooks
$('td[id$=PickupAtStoreColumn] div.multipleship').each(function() { $(this).html($(this).html().replace("To pick up at the bookstore","Reserve Your Textbooks")); });
// Change "Pick Up At Store" button text on Step 2 of checkout to Reservation Pickup
$('td[id$=PickupAtStoreColumn] input[id$=btnPickupAtStore]').attr('value','Reservation Pick-up');
How can I check to see if select[id$=drpShipType] has “Text Reserv. Pick-up” enabled as an option first? Thanks!
If your select element’s options have values specified, you can detect whether the option exists via: