Title: How to change theme customizer image control value using JavaScript
Last modified: October 15, 2018

---

# How to change theme customizer image control value using JavaScript

 *  [simon128](https://wordpress.org/support/users/simon128/)
 * (@simon128)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/how-to-change-theme-customizer-image-control-value-using-javascript/)
 * Hi guys, I want to change the value of WP Customizer Image Control using JavaScript
   API.
 * I tried to change the value with below code. But it does not work.
 * wp.customize.instance(‘background-image’).set( ‘[http://urltoimage.jpg&#8217](http://urltoimage.jpg&#8217););
 * Anyone can help, please?
 * Thanks Simon

Viewing 1 replies (of 1 total)

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/how-to-change-theme-customizer-image-control-value-using-javascript/#post-10783131)
 * I have a loop (for presets) that uses this code, which works.
 *     ```
       	var old = {};
       	var setting = wp.customize( id );
       	if ( setting ) {
       		old[id] = setting.get();
       		setting.set( value );
       	}
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘How to change theme customizer image control value using JavaScript’ 
is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 2 participants
 * Last reply from: [Joy](https://wordpress.org/support/users/joyously/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/how-to-change-theme-customizer-image-control-value-using-javascript/#post-10783131)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
