I’ve searched and not found an answer to why my .js file keeps giving me an error wp not defined in the wp.customize function.
I’ve enqueued the script like this
function ws_customizer_live_preview(){ wp_enqueue_script( 'ws-themecustomizer', get_template_directory_uri() .'/library/js/theme-customizer.js', array( 'jquery','customize-preview' ), true ); } add_action( 'customize_preview_init', 'ws_customizer_live_preview' );
This was basically copied from WP Docs. The javascript is
(function( $ ) {
"use strict";
wp.customize( 'ws_display_header', function( value ) {
value.bind( function( to ) {
false === to ? $( '.header' ).hide() : $( '.header' ).show();
} );
});
wp.customize( 'ws_footer_copyright_text', function( value ) {
value.bind( function( to ) {
$( 'span#copyright-message' ).text( to );
});
}); })(jQuery);
I need to know why the wp.customize in the js is giving me wp not defined error.
Thank you