jQuery – Open cookie settings on element click

0.0/5
<?php
add_action('wp_footer', function(){
?>
	<script>
		jQuery(document).ready(function(){
			jQuery("Your selector here").click(function(e) { //Put your selector here
				jQuery(".cookie-settings-shortcode a").click(); //click
				e.preventDefault(); //prevent infinite loop
			});
		});
	</script>
<?php
});

Comments and reviews

{{ reviewsTotal }} Review
{{ reviewsTotal }} Reviews
{{ options.labels.newReviewButton }}
{{ userData.canReview.message }}

Description

This snippet adds a script that opens the Cookie settings popup after clicking on an element matching a given selector.

Author

Tags

This snippet is untagged