Uncaught TypeError: TableInit is not a constructor


我最近在做東西的時候,用到了Bootstrap的表格,我復制了一份代碼使用,結果運行報錯

Uncaught TypeError: TableInit is not a constructor

我點進去一看,定位如下

var oTable = new TableInit();

其實這種錯誤,沒辦法調試,但是錯誤一般都是你少寫了) } 或者寫錯了位置

就比如我這次,就是寫錯了位置

<script type="text/javascript">
        $(function() {
            //1.初始化Table
            var oTable = new TableInit();
            oTable.Init();
            //2.初始化Button的點擊事件
            var oButtonInit = new ButtonInit();
            oButtonInit.Init();
        })

        var TableInit = function() {
            var oTableInit = new Object();
            //初始化Table
            oTableInit.Init = function() {

應該把TableInit方法放到Jquery的函數之外


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM