-
-
Save Crocoblock/0ac9f6c1e7e83ab5baa2f4f4890dc6e5 to your computer and use it in GitHub Desktop.
JetFormbuilder media field text after upload
This file contains hidden or 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
| 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') | |
| }); | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment