最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

jquerysubmit()不能提交表单如何解决

来源:动视网 责编:小OO 时间:2020-11-27 20:05:41
文档

jquerysubmit()不能提交表单如何解决

今天写表单提交的时候需要增加一个确认提示,所以没有使用submit按钮提交,改用jq的submit(),然后问题了。;<;form class=";form-horizontal m-t";method=";post";action=";@Url.Action(";Edit";)";id=";form";>;<;p class=";row";>;<;p class=";col-sm-12";>;<;p class=";ibox float-e-margins";>;<;p class=";>。
推荐度:
导读今天写表单提交的时候需要增加一个确认提示,所以没有使用submit按钮提交,改用jq的submit(),然后问题了。;<;form class=";form-horizontal m-t";method=";post";action=";@Url.Action(";Edit";)";id=";form";>;<;p class=";row";>;<;p class=";col-sm-12";>;<;p class=";ibox float-e-margins";>;<;p class=";>。


本文主要为大家详细介绍了jquery submit()不能提交表单的解决方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,希望能帮助到大家。

今天写表单提交的时候需要增加一个确认提示,所以没有使用submit按钮提交,改用jq的submit(),然后问题了

<form class="form-horizontal m-t" method="post" action="@Url.Action("Edit")" id="form">
 <p class="row">
 <p class="col-sm-12">
 <p class="ibox float-e-margins">
 <p class="ibox-title">
 <h5>添加</h5>
 </p>
 <p class="ibox-content">
 <p class="form-group">
 <label class="col-sm-3 control-label">开始时间:</label>
 <p class="col-sm-8">
 <span>
 @(Model.annualRate_beginDate?.ToString("yyyy-MM-dd"))
 </span>
 </p>
 </p>
 <p class="form-group">
 <label class="col-sm-3 control-label">结束时间:</label>
 <p class="col-sm-8">
 <input type="text" class="form-control" name="annualRate_endDate" id="annualRate_endDate" onclick="laydate({ istime: false, format: 'YYYY-MM-DD' })" value="@Model.annualRate_endDate.ToString("yyyy-MM-dd")" required>
 </p>
 </p>
 <p class="form-group">
 <label class="col-sm-3 control-label">年利息%:</label>
 <p class="col-sm-8">
 <input type="number" step="0.01" class="form-control" id="annualRate_rate" name="annualRate_rate" value="@Model.annualRate_rate.ToString("#0.00")" required>
 </p>
 </p>
 <p class="form-group">
 <p class="col-sm-4 col-sm-offset-2">
 <button class="btn btn-lg btn-primary" id="submit_btn" type="button">
 提交
 </button>

 <a class="btn btn-lg btn-white" href="@Url.Action(" rel="external nofollow" Index")">
 取消
 </a>
 </p>
 </p>
 </p>
 </p>

 </p>
 </p>
 </form>

点击提交按钮出现确认提示,但是确认后就没反应了

但是将button的type改为submit却又能提交

于是上jQuery API查找原因,看到以下这段文字顿时明白了:

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.

大概意思是表单和其子元素不宜用一个表单的属性的属性作为name或id的名称,如submit, length, 和 method等,否则会产生冲突,名称冲突可能就会导致这种情况。

原来是因为按钮id设为了submit

文档

jquerysubmit()不能提交表单如何解决

今天写表单提交的时候需要增加一个确认提示,所以没有使用submit按钮提交,改用jq的submit(),然后问题了。;<;form class=";form-horizontal m-t";method=";post";action=";@Url.Action(";Edit";)";id=";form";>;<;p class=";row";>;<;p class=";col-sm-12";>;<;p class=";ibox float-e-margins";>;<;p class=";>。
推荐度:
标签: 解决 () Forms
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top