5
1
Fork 0
mirror of https://github.com/Anvilcraft/jensmemes synced 2024-09-25 02:38:51 +02:00
jensmemes/website/button.js

18 lines
498 B
JavaScript
Raw Normal View History

2020-06-26 21:11:18 +02:00
const realFileBtn = document.getElementById("real-file");
const customBtn = document.getElementById("custom-button");
const customTxt = document.getElementById("custom-text");
customBtn.addEventListener("click", function() {
realFileBtn.click();
});
realFileBtn.addEventListener("change", function() {
if (realFileBtn.value) {
customTxt.innerHTML = realFileBtn.value.match(
/[\/\\]([\w\d\s\.\-\(\)]+)$/
)[1];
} else {
customTxt.innerHTML = "No file chosen, yet.";
}
});