As per the codex, this question an probably any tutorial on the theme customiser out there, you get the value of a customiser field with the following code:
( function( $ ) {
//Update site background color...
wp.customize( 'background_color', function( value ) {
value.bind( function( newval ) {
$('body').css('background-color', newval );
} );
} );
} )( jQuery );
The problem is you can get that value, when its changed.
My question, is how (in a sane way) can you retrieve the value of another field in that same callback.
E.g.
( function( $ ) {
//Update site background color...
wp.customize( 'background_color', function( value ) {
value.bind( function( newval ) {
//Get value of field 'text_colour'
//var text_colour = ??
$('body').css('background-color', newval );
} );
} );
} )( jQuery );