JQuery тип файла ввода * .xlsx - PullRequest
0 голосов
/ 18 марта 2019

кто-нибудь знает, почему

$('#id_thefile').attr('accept', '*.xlsx');
<html>
<head>
<script language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.slim.min.js">
</script>
</head>
<body>

<!-- the input I want to change with jquery //-->
<input id="id_thefile" type="file" />

не работает?

Приветствия

Карлос.

1 Ответ

0 голосов
/ 18 марта 2019

изменение

$('#id_thefile').attr('accept', '*.xlsx');

до

$('#id_thefile').attr('accept', '.xlsx');

или

Вы также можете напрямую добавить, что в HTML принимайте, как показано ниже

<html>
<head>
</script>
</head>
<body>

<!-- the input I want to change with jquery //-->
<input id="id_thefile" type="file" accept=".xls,.xlsx"/>
...