Created
October 31, 2023 13:14
-
-
Save andxbes/78c037dc89524772bdb63943163adc54 to your computer and use it in GitHub Desktop.
input_file.js
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
//Change label for file | |
jQuery(document).ready(function ($) { | |
let $file_container = $('.file-upload'); | |
if ($file_container.length > 0) { | |
$file_container.each(function () { | |
let $container = $(this); | |
let $file_input = $container.find('.wpcf7-file'); | |
let $label = $container.find('.file-label__text'); | |
$file_input.change(function () { | |
var out = ""; | |
if (this.files.length > 0) { | |
out = [].slice.call(this.files).map(function (f) { return f.name; }).join(", "); | |
} | |
$label.text(out); | |
}); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment