From fe27fab561d78781a215d52cad33566f09de0bf8 Mon Sep 17 00:00:00 2001 From: Felix Hamann Date: Sun, 25 Mar 2018 20:46:21 +0200 Subject: [PATCH] multi-file-inputs now with labels instead of spans --- templates/standalone/inputs.julius | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/standalone/inputs.julius b/templates/standalone/inputs.julius index 10a32bd18..926dccd1e 100644 --- a/templates/standalone/inputs.julius +++ b/templates/standalone/inputs.julius @@ -24,6 +24,7 @@ }); }; + // allows for multiple file uploads with separate inputs window.utils.reactiveFileUpload = function(input, parent) { var currValidInputCount = 0; var addMore = false; @@ -95,9 +96,6 @@ fileInput.input.addEventListener('blur', function() { fileInput.container.classList.remove('pseudo-focus'); }); - fileInput.label.addEventListener('click', function() { - fileInput.input.click(); - }); fileInput.remover.addEventListener('click', function() { if (fileInput.isValid()) { currValidInputCount--; @@ -109,12 +107,14 @@ // create new wrapped input element with name name function makeInput(name) { var cont = document.createElement('div'); - var desc = document.createElement('span'); + var desc = document.createElement('label'); var nextInput = document.createElement('input'); var remover = document.createElement('div'); cont.classList.add('file-input__container'); desc.classList.add('file-input__label', 'btn'); + desc.setAttribute('for', name + '-' + currValidInputCount); remover.classList.add('file-input__remover'); + nextInput.setAttribute('id', name + '-' + currValidInputCount); nextInput.setAttribute('name', name); nextInput.setAttribute('type', 'file'); cont.appendChild(nextInput);