My knowledge of Jquery / Javascript is very limited. I got stuck with a code that shows / hides the add to cart button and a blinking message on the product page of Joomla, Virtuemart depending on the choices of the custom fields which are dropdown lists. On the product page that has a single custom field everything works just fine. Only when the user selects something other than the default value the blinking message disappears and the add to cart button appears. Please see here : https://leathercareland.com/en/leather-care-peripoiisi-dematos/proionta-saphir-saphir-products/pommadier-creme-gl-76-detail. On the product page that has multiple custom fields if a user makes a choice in any of the dropdowns then the add to cart appears. Please see here : https://leathercareland.com/en/leather-care-peripoiisi-dematos/vafes-ypodimaton-kai-dermatinon-eidon-shoe-and-leather-dyes/starter-set-big-detail. I need to modify the provided code so that on the page that has multiple dropdown lists only when the user has made a choice on every dropdown list to have the add to card button appear. The code is as follows:
<script>
jQuery(document).ready(function ($) {
function blink() {
$('.blink_slow').fadeOut(500).fadeIn(500, blink);
}
blink();
$(".tab-content").not(':first').css("display", "none");
$("ul.tabs li:first").addClass("active");
$("ul.tabs a").click(function(event) {
event.preventDefault();
$(this).parent().addClass("active");
$(this).parent().siblings().removeClass("active");
var tab = $(this).attr("href");
$(".tab-content").not(tab).css("display", "none");
$(tab).fadeIn();
});
$('.quickadd').parent().click(
function() {
var btn = $(this),href = btn.find('a').eq(0).attr('href'),
dat = $(this).closest('form').serialize();
window.parent.vmQuickAdd(dat);
return false;
});
$('.product-fields select').each(function(){
var $select = $(this);
//console.log($select.val());
if(($select.val() === 'COM_VIRTUEMART_PLEASE_CHOOSE') || ($select.val() === 'COM_VIRTUEMART_PLEASE_CHOOSE_LAST')){
$('.addtocart-bar').hide();
$select.change(function(){
if(($select.val() === 'COM_VIRTUEMART_PLEASE_CHOOSE') || ($select.val() === 'COM_VIRTUEMART_PLEASE_CHOOSE_LAST')) {
$('.addtocart-bar').hide();
$('.flash').show(); }
else { $('.addtocart-bar').show(); $('.flash').hide();}
});
}
});
});
</script>
I know that I need to check for values on every dropdown list but I cannot do that programmatically....
Is there any one out there that he/she can help or give me ideas with possible examples?
Thanks George