This weird looking snippet will help you read a WP customzer value dynamically. You'll have to enqueue the JS at the right spots.

For example:

  • customize_preview_init
  • customize_controls_enqueue_scripts

How to get a WordPress customizer field value?

var some_value = wp.customize.value( 'my_field_setting' )();

How to set a WordPress customizer field value?

var some_value = wp.customize.value( 'my_field_setting' )('some_value');

 

Related
https://stackoverflow.com/questions/33234217/wp-customize-get-value-from-a-setting-and-store-in-a-variable