Skip to content

Instantly share code, notes, and snippets.

@dislokacia
Last active April 30, 2023 00:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dislokacia/6d609603bbb8f30cfe4e53d98251d29b to your computer and use it in GitHub Desktop.
Save dislokacia/6d609603bbb8f30cfe4e53d98251d29b to your computer and use it in GitHub Desktop.
JetFormbuilder media field text after upload
jQuery(document).ready(function( $ ){
$('.jet-form-builder-file-upload__fields').each(function(index){
let upload = $(this).find('.jet-form-builder-file-upload__input');
$(this).append('<input type="button" class="addfile" value="Choose file"/>');
$(this).append('<label class="labeladdfile">Choose file</label></div>');
let labelAdd = $(this).find('.labeladdfile');
let buttonAdd = $(this).find('.addfile');
let uploadValue = $(this).find('.jet-form-builder-file-upload__files');
upload.css('display','none');
$(this).find('.addfile').click(function () {
upload.trigger('click');
});
let buttonDelete = $(this).siblings('.jet-form-builder-file-upload__content').find('.jet-form-builder-file-upload__files');
upload.on('change', function(){
if( uploadValue.length > 0 ){
labelAdd.html("Choose file");
} else {
labelAdd.html("file uploaded");
buttonAdd.attr('value', 'File Uploaded')
}
buttonDelete.on('click', function(){
labelAdd.html("Choose file");
buttonAdd.attr('value', 'Choose file')
});
});
});
});
@dislokacia
Copy link
Author

Add this code to this plugin https://prnt.sc/qe_RpUCosNo5 https://prnt.sc/tgx9EjuPnIDk
And it will work like on video https://www.loom.com/share/7d91130691f7444b942d145d5991b6de
Code is only for JetFormbuilder only
You can change the text of the button and label, as you need
All stylings for button will be taken from the theme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment