Created
June 6, 2017 09:45
-
-
Save N-Molham/79112f9f21d62659ef8ed0942936ba9d to your computer and use it in GitHub Desktop.
Set the closest field input value to the selected file URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// select handler | |
var on_file_select = function ( $button ) { | |
return function () { | |
// fetch selected file | |
selected_file_url = file_frame.state().get( 'selection' ).first().toJSON().url; | |
// set linked field input new value | |
$button.closest( '.acf-input' ).find( '.acf-url input[type=url]' ).val( selected_file_url ).trigger( 'change' ); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment