mercredi 27 octobre 2021

Display image when checkbox is checked

I was able to do it via dropdown and also hiding the not chosen items with the following ( I am using Elementor/Wordpress )

$('#input_17_19').on('change', function() {
              var item = this.value;
              if(item == "Straw") {
                 $("#decal_preview").hide();
                 $("#decal_straw").show();
                 $("#decal_fork").hide();
                 $("#decal_knife").hide();
                 $("#decal_chopsticks").hide();
                 $("#decal_lids").hide();
                 $("#decal_tips_sign_blue").hide();
                 $("#decal_tips_sign_red").hide();
                 $("#decal_large_takeout_blue").hide();
                 $("#decal_large_takeout_red").hide();
                 $("#decal_small_takeout_blue").hide();
                 $("#decal_small_takeout_red").hide();
                 $("decal_napkin_blue").hide();         
                 $("#decal_napkin_red").hide();
                 $("#decal_regular_soy").hide();   
                 $("#decal_low_soy").hide();
                 $("#decal_pepper_soy").hide();
                 $("#decal_salt_soy").hide();
                 $("#decal_server_station").hide();
              }

But I can't figure out how to do it for checkbox . I assign classes for each images like shown above .

Any help is appreciated .




Aucun commentaire:

Enregistrer un commentaire