Change an image based off one Select

Home Forums Quform WordPress Change an image based off one Select

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #33613
    GOMLP
    Participant

    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);
    });

    #33614
    GOMLP
    Participant

    No 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);
    });

    #33622
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy