学无先后,达者为师

网站首页 编程语言 正文

h5给input元素type=file的对象赋值报错

作者:Alex_designer 更新时间: 2022-04-05 编程语言

Failed to set the 'value' property on 'HTMLInputElement': This input element accepts a filename, which may only be programmatically set to the empty string

  <input type="file" class=" form-control hide" placeholder="文件地址" id="filePath" />

$("#filePath").val(path);

  type="file"  标签的类型为file只能手动选择 不能程序设置值。   去掉$("#filePath").val(path);

原文链接:https://blog.csdn.net/m0_37622302/article/details/123031490

栏目分类
最近更新