未捕获的TypeError:对象#<htmlformelement>的属性'submit'不是函数</htmlformelement>

时间:2014-03-18 11:36:41

标签: jquery

该类型设置为“提交”但仍然无效。我正在使用console.log但是没有显示任何内容。我希望控制台日志显示一个数字(两个通过ajax加在一起)

我该如何解决这个问题?

Jquery代码:

jQuery(document).ready( function($) {
(function($) {
$(document).ready(function(){
  $('#formsubmit').submit(function(){
  $.post(
  PT_Ajax.ajaxurl,
        {
       action : 'ajax-inputtitleSubmit',
       noofwelds : $('input[name=numberofwelds]').val(),
       noofconwelds : $('input[name=numberofconwelds]').val(),
       nextNonce : PT_Ajax.nextNonce
        },
  function( response ) {
     console.log( response );
        }
        );
      return false;
}); 

});
})(jQuery);
}); 

表格

<form action="" method="post" type="submit" name="formsubmit" id="formsubmit"   >
<h1> Process </h1>
<p> operation type always robot </p>
<br> <br>
Number of welds: <input type="number" name="numberofwelds" id="numberofwelds"  >
<br> <br>
Number of construction welds: <input type="number" name="numberofconwelds" id="numberofconwelds"  >
<br> <br>
Total one: <input type="text" name="totalone" id="totalone" disabled>
<div id="totalfail1"></div>
<br> <br> 
Total two: <input type="text" name="totaltwo" id="totaltwo" disabled>
<div id="totalfail2"></div>
<br> <br> <br> <br>
Total three: <input type="text" name="totalthree" id="totalthree" disabled>
<div id="totalfail3"></div>
<br> <br> <br> <br>
<input type="submit"  value="Calculate" id="formsubmit" name="submit" class="ajax-link" >
<div id="result"> </div>
</form> 

1 个答案:

答案 0 :(得分:16)

这是因为您的表单中有一个名为input的{​​{1}}元素,请将其重命名

submit