Adding click event to select option

Discussion in 'jQuery' started by EASYDOMAIN4ALL, Jun 25, 2016.

  1. #1
    Hi all,
    My site is here https://dev.wpnwear.com/shop/tops/gradient-t-shirt/

    I am trying to add a click event on any color option.

    I have added following in functions.php in my theme
    
    function ddfgn_wpn_7876565_9098_987() {
        if( wp_script_is( 'jquery', 'done' ) ) {
            ?>
            <script type="text/javascript">
                jQuery(document).ready(function() {
                    jQuery("#pa_colour").change(function(){
                        //do somthing
                        //jQuery(".reset_variations").text("Color Changed");
                        alert("Hello");
                    })
                });
            </script>
            <?php
        }
    }
    add_action( 'admin_print_footer_scripts', 'ddfgn_wpn_7876565_9098_987' );
    
    PHP:
    But it does not show any alert.

    Ultimately I want to catch any click on any color and add a click event on "M" size so that all variation images loads properly.

    Any help will be much appreciated!

    Thank you & Regards,
    Krish
     
    EASYDOMAIN4ALL, Jun 25, 2016 IP