javascript - attr("disabled", false) 在 Typescript 中导致错误
问题描述
我的 ts 文件中有以下代码:
$('input[type=hidden]').attr("disabled", false);
代码有效,但我收到以下错误:“假”类型的参数不可分配给“字符串”类型的参数 | 号码 | (((this: HTMLElement, index: number, attr: string) => string | number | void)'。
解决方案
您应该完全删除属性。
$('input[type=hidden]').removeAttr("disabled");
推荐阅读
- c++ - c++ 多级模板
- kubernetes - kubernetes 服务中可以暴露的端口数量是否有任何限制?
- javascript - JavaScript - Convert decimal number to 4-bit binary number in the form of String
- c# - 在 Xamarin.FORMS 中的 Designer 中预览字体
- php - WordPress 错误:您的网站出现严重错误。请检查您的站点管理员电子邮件收件箱以获取说明
- hadoop - Nutch 1.17 网络爬取与存储优化
- java - 在 BottomNavigationView 添加 4 个菜单(项目)时显示错误
- flutter - CustomScrollView Flutter 中的复杂条子
- javascript - 角度从 api 获取具有样式背景图像的图像
- javascript - 如果给出的代码在 js 上正确,音频将如何播放