【问题标题】:jquery input type file *.xlsxjquery 输入类型文件 *.xlsx
【发布时间】:2019-08-08 20:20:54
【问题描述】:

有人知道原因吗

$('#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" />

不工作?

干杯,

卡洛斯。

【问题讨论】:

  • 不需要* 只需使用'.xlsx'

标签: jquery file input types


【解决方案1】:

改变

$('#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"/>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 2018-12-28
    • 1970-01-01
    • 1970-01-01
    • 2022-06-10
    • 2011-03-03
    • 2011-08-29
    相关资源
    最近更新 更多