I want to bind a click event to Wordpress custom control (Theme Customizer). I have tried with (customizer.js
):
$(document).on('click', '.element_class', function () {
console.log(5);
});
, but it doesn't bind.
The control is something like :
<div class="element_class">
Value
</div>
functions.php
:
function customizer_live_preview() {
wp_enqueue_script(
'theme-customizer',
get_stylesheet_directory_uri() . 'customizer.js',
array( 'customize-preview' ), '0.1.0', true);
}
add_action( 'customize_preview_init', 'customizer_live_preview' );