jquery submit()不执行

好吧我承认我竟然犯低级错误了。。。我忏悔。。。为了提醒自己置顶一个礼拜

 

复制代码
<form id="form" method="post">
<input  type="text" name="ceshi" value="测试"/><button type="button" id="submit">提交</button>
</form>
<script type="text/javascript">
$(function(){
    $('#submit').click(function(){
        $('#form').submit()
    })
})
</script>
复制代码

上述代码看上去貌似没什么问题,但是点击查询按钮的时候死活不提交表单,按钮type改为submit表单提交正常。


Additional Notes: Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint.

 

其他注意事项: 表单和其子元素不宜用一个表单的属性的属性作为nameid的名称,如submit, length, or method,是、会产生冲突。名称冲突可能会导致混乱的失败。对于一个完整的规则列表,并检查这些问题标记,看DOMLint。

 

然后我把id名字改了就执行了

 

posted @   一点点白  阅读(5178)  评论(1编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
点击右上角即可分享
微信分享提示