Очистка поля типа file

01.09.16 07:20:02 01.09.16 07:24:56 129

Очистка поля типа file

function clearFileInputField(Id) { document.getElementById(Id).innerHTML = document.getElementById(Id).innerHTML; }

Пример:

<!DOCTYPE html> <html> <head> <title>Untitled Page</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script type="text/javascript"> function clearFileInputField(Id) { document.getElementById(Id).innerHTML = document.getElementById(Id).innerHTML; } </script> </head> <body> <form action=""> <div id="fileInputContainer"> <input id="fileInput" name="fileInput" type="file"> </div> <a href="#" onclick="clearFileInputField('fileInputContainer'); return false;">Очистить</a> </form> </body> </html>