mirror of
https://github.com/Anvilcraft/jensmemes
synced 2024-11-13 21:41:27 +01:00
18 lines
498 B
JavaScript
18 lines
498 B
JavaScript
|
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.";
|
||
|
}
|
||
|
});
|