• Dear Ladies and Gents,
    i am having 2 datepicker fields (Before Add To Cart Button) which works fine.
    But if the valdiation had an error the “Add TO CART” button is inactive, no matter what i click.
    So i wrote a small jQuery which disables the “ADD TO CART” button out if there are errors:

    var idevArrival = jQuery("input[name=arrival]").val();
    var idevDeparture = jQuery("input[name=departure]").val();
    
    if (idevArrival == '' || idevDeparture == '') {
    	alert('Empty values')
    	jQuery('.single_add_to_cart_button').css( "display", 'none' );
    }

    But i am not able to catch changes on the 2 date fields to bring the button back.
    I tryed with the jQuery “change” function but is doesn’t do the job:

        jQuery('input[name=arrival]').change(function(){
            alert("The text has been changed.");
        });

    Any (quick) help is highly appreciated.
    Many thanks in advance,
    Joe

The topic ‘cannot catch changed values of fields’ is closed to new replies.