2014-11-25 198 views
0

我有一点javascript,我试图解开,它是在PHP窗体上计算抵押还款,但单击计算按钮什么也不做。Javascript:未定义不是函数错误

看着Chrome的控制台我得到的消息

Uncaught TypeError: Undefined is not a function" on line 10($("#form_7") to 19

下面的代码的

<script type="text/javascript"> 
    $(document).ready(function() { 
     $("a.ActiveButton").bind({ 
      mousedown:function(){ 
       if ($(this).attr('disabled') === undefined) 
        $(this).addClass('Activated'); 
      }, 
      mouseleave:function(){ 
       if ($(this).attr('disabled') === undefined) 
        $(this).removeClass('Activated'); 
      }, 
      mouseup:function(){ 
       if ($(this).attr('disabled') === undefined) 
        $(this).removeClass('Activated'); 
      } 
     }); 

     $("#form_7").validate({ 
      onkeyup: false, 
      showErrors: function(errorMap, errorList) { 
       if (errorList.length) alert(errorList[0].message); 
      }, 
      onclick: false, 
      rules: { 
       'Property_Price': { number: true } , 
       'Deposit': { number: true } , 
       'Duration': { number: true } , 
       'InterestRate': { number: true } 
      }, 
      onfocusout: false, 
      messages: { 
       'Property_Price': { number: "Please enter the property purchase price." } , 
       'Deposit': { number: "Please enter your deposit amount or 0 if there is no deposit." } , 
       'Duration': { number: "Please enter the duration of the mortgage." } , 
       'InterestRate': { number: "Please enter the mortgage interest rate." } 
      } 
     }); 

     $('#btn_4').click(function(){validate_form_7(form_7)}); 
    }); 
</script> 

有谁知道是什么原因导致这个错误以及它如何解决?

+0

我不认为你已经导入jquery – Jordy 2014-11-25 12:39:36

+0

这是可能的,但通常在这种情况下,错误信息是:['未捕获的ReferenceError:$未定义](http://jsfiddle.net/davidThomas/dybmn6rk/1/ )。 – 2014-11-25 12:41:58

+0

jQuery可能在那里,但验证插件可能不是。 – Deleteman 2014-11-25 12:44:27

回答

0

答案是你的代码试图作为一个函数取消引用的东西,这不是一个。

尝试在浏览器中启用停止异常模式,并查看代码在崩溃时尝试调用的“函数”。一旦你有一个堆栈跟踪,你会发现,并为我们提供帮助。

副手,我没有看到提供的代码的任何问题。

+0

教学如何调试也不提供答案。 – DontVoteMeDown 2014-11-25 12:46:29

+0

@DontVoteMeDown给一个人发火,他会温暖一个晚上。教一个人点亮它,他的一生都会温暖。此外,还可以通过附加信息进行改进,而且这是别无他物的第二好选择 - 或者讽刺评论。 – 2014-11-25 12:49:15

+0

当然,调试部分是相关的,但它仍然没有回答。我的意思是,一个真正的解决方案与所有的调试建议将是完美的。 – DontVoteMeDown 2014-11-25 12:51:29

1

看起来你没有验证定义。

相关问题