You use the customize_controls_enqueue_scripts
action hook for that. Then you enqueue script as usual. Like this:
function wpse256911_customizer_enqueue() {
wp_enqueue_script( 'my-customizer', get_stylesheet_directory_uri() . '/js/my-customizer.js', array( 'jquery', 'customize-controls' ) );
}
add_action( 'customize_controls_enqueue_scripts', 'wpse256911_customizer_enqueue' );
Related Posts:
- Customizer JS API
- Is it Possible to Extend WP Customize JS Methods?
- wp.customize.bind ready event not fired
- Detecting WordPress Customizer Panel
- WP Customizer set a value via javascript (to create presets)
- wp_customize_support_script – do I need it?
- Customizer – instantiating settings and controls via javascript
- Customizer JS API: Defining control settings
- Customizer JS API: Adding Setting Dynamically Not Working
- Customizer: When to use customize_preview_init VS customize_controls_enqueue_scripts
- How to overwrite JS variable with wp_localize _script?
- Theme Customiser not live previewing changes on pseudo elements
- the Customizer – proper way to instantiate an image upload control via javascript
- Preserve Javascript Through Customizer Preview Navigation
- How to check if customize previewer is refreshing?
- JavaScript in WordPress Customizer
- Customizer JS API: Adding a “dropdown-pages” control
- Accessing customizer values in javascript
- Running JS after theme customizer finished initialization
- customize_preview_init: listening for any changes from Customizer preview area
- How to conditionally show/hide controls & sections in WordPress customizer?
- Multiple Conditional Controllers
- WordPress customizer get control
- Using webpack to add customizer live preview functionality – wp.customize is not a function
- Adding and removing hidden buttons from WordPress Customizer Tinymce widget editor using javascript API
- Get a default value of the Customizer setting using wp.customize API (JS)
- How to add customizer control via javascript ( wp.customizer.control.add )
- Load page in customizer preview on panel click?
- Customizer JS API: Defining active_callback for a section
- Custom JS text area in customizer is being formatted wrong in document
- customize-controls.js – extend api.previewer
- Multiple jQuery inputs or binds in Customizer Control Javascripts
- Show sections based on a control in WordPress Customizer using JS API
- How do I add a class to Customizer preview based on class of Customizer control? (Customizer Javascript API)
- LayersWP Customizer White Blank Screen
- Get a default customizeAction text for a section using Customizer JS API
- Receive “menu-toogle” event from section menu in customizer
- How do I make the first letter of a string uppercase in JavaScript?
- window.location.href and window.open () methods in JavaScript
- Define a global variable in a JavaScript function
- Can’t bind to ‘ngModel’ since it isn’t a known property of ‘input’
- Cross-Origin Read Blocking (CORB)
- Include another HTML file in a HTML file
- Cannot open local file – Chrome: Not allowed to load local resource
- How to read a local text file?
- Compare dates with javascript
- Javascript Uncaught SyntaxError: Unexpected identifier
- “document.getElementByClass is not a function”
- How can I create a two dimensional array in JavaScript?
- How can I refresh a page with jQuery?
- Bootstrap Dropdown menu is not working
- String.prototype.replaceAll() not working
- What does the className attribute mean in JSX?
- How do I check for null values in JavaScript?
- Pure JavaScript: a function like jQuery’s isNumeric()
- Angular4 – No value accessor for form control
- What is the difference between ( for… in ) and ( for… of ) statements?
- TypeError: Cannot read property “0” from undefined
- How to use npm jquery module?
- Jquery swipe left or right on mobile
- Sorting arrays in javascript by object key value
- How do I get an element to scroll into view, using jQuery?
- Uncaught SyntaxError: Unexpected token :
- How do I check if string contains substring? [duplicate]
- Error: ENOENT: no such file or directory, stat ‘/public/main.html’ at Error (native)
- JavaScript – cannot set property of undefined
- Why is this jQuery click function not working?
- e.target.value on an input field ReactJs, how does it work?
- How do you convert a JavaScript date to UTC?
- Force div to be topmost element of any and all webpages
- moving an element in JS
- Regular Expression to reformat a US phone number in Javascript
- One liner to flatten nested object
- How to add jQuery in JS file
- Get query string parameters url values with jQuery / Javascript (querystring)
- Add JavaScript object to JavaScript object
- “Uncaught TypeError: Illegal invocation” in Chrome
- What are the differences between JSON and JSONP?
- Check user logged in with JS
- Does javascript have an equivalent to PHP’s preg_replace_callback?
- WP REST – video and audio players
- Move all the JS files to the bottom|footer, the right way
- How to handle Gutenberg wp.data async errors?
- How do I access site and block editor state data and use `useSelect()` or `withSelect()` to bind it to my components?
- How to determine the number of widgets contained in a sidebar via customizer JS
- Any required callbacks to WP.com or WP.org?
- Search media with javascript
- Gutenberg extend blocks add new class name
- best way for app users to submit blog post?
- Using apiFetch for retrieving post data in Gutenberg
- is_page_template() written in jquery/javascript
- Gutenberg getBlockIndex in save() function
- Widgets and Post/Page edit/new blank, console errors only, no server errors
- how to prevent added meta box from being injected with style=”position: fixed; top: 56px;” at scroll down
- Add JavaScript-Library “Fitty” to WordPress
- How to use value from modal tinymce windowManager?
- early enqueueing javascript file in page template, not in functions.php
- Wysiwyg editor not working on 4.2.2
- jQuery + more won’t load in header
- JavaScript errors