Home › Forums › Quform WordPress › Change an image based off one Select
- This topic has 2 replies, 2 voices, and was last updated 3 years ago by Ally.
- AuthorPosts
- November 3, 2021 at 9:18 pm #33613GOMLPParticipant
Hi Ally,
I tried to modify the code you sent for changing an image URL based off two select fields but had no success.
Below is the code I tried, maybe it can’t be done or once again I placed a “{” thing-a-ma-bob in the wrong place.
jQuery(function ($) {
function setImageUrl() {
var foilCode = $(‘.quform-field-14_211′).val(),
foilImage = ”;if (foilCode !== ”) {
// Black Vellum 16256
if (foilCode === ’29’) {
foilImage = ‘QuoteSubstrates/Foils/29.png’;
} else if (foilCode === ’17’) {
foilImage = ‘QuoteSubstrates/Foils/17.png;
} else if (foilCode === ’10’) {
foilImage = ‘QuoteSubstrates/Foils/10.png’;
} else if (foilCode === ’19’) {
foilImage = ‘QuoteSubstrates/Foils/19.png’;
} else if (foilCode === ’25’) {
foilImage = ‘QuoteSubstrates/Foils/25.png’;
} else if (foilCode === ’44’) {
foilImage = ‘QuoteSubstrates/Foils/44.png’;
} else if (foilCode === ’43’) {
foilImage = ‘QuoteSubstrates/Foils/43.png’;
} else if (foilCode === ’82’) {
foilImage = ‘QuoteSubstrates/Foils/82.png’;
}} else {
finishingImage = ”;
}$(‘#finishing-Image’).attr(‘src’, ‘http://gomlp.biz/wp-content/’ + foilImage);
}$(‘.quform-field-14_211).on(‘change’, setImageUrl);
});November 3, 2021 at 9:35 pm #33614GOMLPParticipantNo need to reply to this one, I was able to figure it out… I actually found a really good page for assisting in checking the code for missing elements and structure, URL below:
https://beautifytools.com/javascript-validator.php
My Code I got working…. You are teaching me 😉
jQuery(function ($) {
function setImageUrl() {
var foilCode = $(‘.quform-field-14_211′).val(),
foilImage = ”;if (foilCode !== ”) {
// Black Vellum 16256
if (foilCode === ’29’) {
foilImage = ‘QuoteSubstrates/Foils/29.png’;
} else if (foilCode === ’17’) {
foilImage = ‘QuoteSubstrates/Foils/17.png’;
} else if (foilCode === ’10’) {
foilImage = ‘QuoteSubstrates/Foils/10.png’;
} else if (foilCode === ’19’) {
foilImage = ‘QuoteSubstrates/Foils/19.png’;
} else if (foilCode === ’25’) {
foilImage = ‘QuoteSubstrates/Foils/25.png’;
} else if (foilCode === ’44’) {
foilImage = ‘QuoteSubstrates/Foils/44.png’;
} else if (foilCode === ’43’) {
foilImage = ‘QuoteSubstrates/Foils/43.png’;
} else if (foilCode === ’82’) {
foilImage = ‘QuoteSubstrates/Foils/82.png’;
}} else {
foilImage = ‘QuoteSubstrates/empty.png’;
}$(‘#foiling-Image’).attr(‘src’, ‘http://gomlp.biz/wp-content/’ + foilImage);
}$(‘.quform-field-14_211’).on(‘change’, setImageUrl);
});November 4, 2021 at 9:52 am #33622AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.