微信开发者工具代码如下<form bindsubmit="formSubmit" bindreset="formReset"> <view> 姓名:<input type="text" name="xingming" placeholder="请输入姓名" /> </view> <view> 密码:<input type="text" name="pwd" password="true" placeholder="请输入密码" /> </view> <radio-group name="sex"> <radio value="1">男</radio> <radio value="2">女</radio> </radio-group> <checkbox-group name="aihao"> <checkbox value="1">篮球</checkbox> <checkbox value="2">羽毛球</checkbox> </checkbox-group>formReset: function(e) { wx.showToast({ title: '数据已重置', duration: '1000' }) },为何点击重置无响应 <slider name="shengao" min="160" max="200" show-value="true"></slider> <button form-type="submit">提交</button> <button form-type="reset">重置</button> </form>
时间: 2023-07-19 18:15:24 浏览: 332
经过查看你提供的代码,我发现重置按钮的绑定事件写成了`bindreset`,但是应该是`bindresetform`。所以你需要将代码中的`bindreset`改为`bindresetform`,就可以解决重置按钮无响应的问题了。修改后的代码如下:
```html
<form bindsubmit="formSubmit" bindresetform="formReset">
<view>姓名:<input type="text" name="xingming" placeholder="请输入姓名" /></view>
<view>密码:<input type="text" name="pwd" password="true" placeholder="请输入密码" /></view>
<radio-group name="sex">
<radio value="1">男</radio>
<radio value="2">女</radio>
</radio-group>
<checkbox-group name="aihao">
<checkbox value="1">篮球</checkbox>
<checkbox value="2">羽毛球</checkbox>
</checkbox-group>
<slider name="shengao" min="160" max="200" show-value="true"></slider>
<button form-type="submit">提交</button>
<button form-type="reset">重置</button>
</form>
```
同时,你需要确保在代码中定义了`formReset`方法,以便重置按钮正确响应。
阅读全文
相关推荐
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![doc](https://img-home.csdnimg.cn/images/20241231044833.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)