Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript] dlaczego nie mogę otworzyć file input poprzez click()?
stellatus
post 23.06.2020, 21:17:15
Post #1





Grupa: Zarejestrowani
Postów: 196
Pomógł: 0
Dołączył: 9.03.2017

Ostrzeżenie: (0%)
-----


Kod
<input type="file" id="file1" style="display:none">
    <a href="#" onclick="openFileOption()">open File Dialog</a>
    <script>
        function openFileOption() {
            document.getElementById("file1").click()
        }
    </script>

https://codepen.io/reti/pen/QWyvBaL

Dlaczego nie mogę otworzyć file input poprzez wywołanie z konsoli:
Kod
document.getElementById("file1").click()

?

Ten post edytował stellatus 23.06.2020, 22:26:09
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 29.05.2024 - 07:14