<分区>
我正在尝试将自定义 css 放在仅由“div”加载的插件上,因此我无法更改它
插件输出为:
<input type="file" name="file" accept=".jpg,.jpeg,.gif,.png">
我需要将它设置为
<input type="file" id="file" name="file" accept=".jpg,.jpeg,.gif,.png">
使用javascript
我已经试过了
<script type="text/javascript">
document.getElementsByName('file')[0].setAttribute('id','file');
</script>
然后返回 未捕获的类型错误:无法读取未定义的属性“setAttribute”