/* color-variable-item.selected*/ add_action( 'wp_footer', 'custom_scripts' ); function custom_scripts() { ?> <script type="text/javascript"> jQuery( document ).ready(function() { jQuery('.rey-quickviewPanel').on('DOMSubtreeModified', function () { setTimeout(function() { console.log('===data color: ' + jQuery('.color-variable-item.selected .variable-item-span').attr('data-color')); jQuery('.color-variable-item .variable-item-span').css("background-color","transparent"); jQuery('.color-variable-item.selected .variable-item-span').css("background-color",jQuery('.color-variable-item.selected .variable-item-span').attr('data-color')); }, 10); }); jQuery('#pa_colors').on('DOMSubtreeModified', function () { setTimeout(function() { console.log('data color: ' + jQuery('.color-variable-item.selected .variable-item-span').attr('data-color')); jQuery('.color-variable-item .variable-item-span').css("background-color","transparent"); jQuery('.color-variable-item.selected .variable-item-span').css("background-color",jQuery('.color-variable-item.selected .variable-item-span').attr('data-color')); }, 10); }); }); </script> <?php } ?>