javascript - 提交表单按钮未在 Safari 中运行 onclick() javascript 函数
问题描述
提交表单按钮未提交并在 Safari 9 及以上版本中丢失样式。它适用于 Chrome 和 Firefox。我看过一些有类似问题的帖子,但提出的所有解决方案都对我不起作用。
在 JS 中,我在按钮中有一个事件处理程序 onsubmit 和一个 onclick 函数来检查字段是否为空,并触发一个弹出窗口,其中信息由 onsubmit 事件处理程序打印。没有在这里粘贴非常庞大的JS代码......
谢谢:
这是该项目的链接:
https://github.com/carlosrbatalha/survey-saving-our-planet
编码:
HTML:
<div class="outer-button">
<button form="survey-form" id="submit" type="submit" name="submit" onclick='myFunction()'>Submit</button>
</div>
CSS:
.outer-button {
display: flex;
flex-direction: row;
justify-content: center;
padding-bottom: 50px;
}
#submit {
background-color: rgba(255,255,255, 0.7);
display: flex;
border:none;
-webkit-border:none;
-webkit-border-radius:0px;
-webkit-appearance:default-button;
justify-content: center;
align-self: center;
width: 100px;
padding:10px;
margin-top: 20px;
font-family: 'Varela Round', sans-serif;
font-size: calc(9px + (21 - 9) * ((100vw - 300px) / (1600 - 300)));
cursor: pointer;
}
#submit:hover{
background-color: rgba(255,255,255, 1);
border: none;
-webkit-border:none;
-webkit-border-radius:0px;
-webkit-appearance:default-button;
}
解决方案
推荐阅读
- javascript - 摇树一个大物体
- javascript - 每列纯 javascript 过滤器复选框
- python - 在 python 中反转列表 - 为什么我无法返回修改后的列表
- facebook - 单击链接而不是自动加载并减少站点负载时启动 Facebook Livechat
- typescript - 为什么键入 Record 有时会抱怨缺少键而有时不会?
- java - 如何修复无法解析从未使用过的符号和变量,错误
- python - pytest-html:有没有办法从结果表中删除失败部分的详细信息
- sql - 如何将列标题更改为映射到 postgres 中的多个值的行值
- python - 如何正确使用 Enumerate 和可变数据?
- consul - 2 个节点之间允许的最大往返时间 (RTT) 是多少?