Это мой рабочий пример страницы https://graphicstogether.com/free-trial/
Я использую контактную форму Wordpress 7. Проблема в том, что когда я нажимаю кнопку очистки в прикрепленном файле, он нажимает кнопку отправки.Как мне управлять каждым действием кнопки индивидуально?
**
Я также сталкиваюсь с ошибкой с кодом JS.Я применил этот код JS в нижнем колонтитуле.
**
![enter image description here](https://i.stack.imgur.com/jokDz.jpg)
Html
<input type="file" name="file-860" size="40" class="wpcf7-form-control wpcf7-file" id="file1" accept=".jpg,.jpeg,.png,.gif,.pdf" aria-invalid="false">
<input type="file" name="file-860" size="40" class="wpcf7-form-control wpcf7-file" id="file2" accept=".jpg,.jpeg,.png,.gif,.pdf" aria-invalid="false">
Дж
var f = document.querySelectorAll('input[type=file]'),
clearInput = function(){this.previousSibling.value = '';};
for(var i = 0; i < f.length; i++){
button = document.createElement('button');
button.textContent = 'clear';
button.addEventListener('click', clearInput);
f[i].parentNode.insertBefore(button, f[i].nextSibling);
}