admin管理员组文章数量:1290090
I'm experimenting around with Backbone.js and am simply trying to get the messages to pop up on my console screen. How ever, every time I do so an error keeps on appearing (noted below)
Uncaught TypeError: Expecting a function in instanceof check, but got [object Object] backbone.js:1032
_.extend.setElement backbone.js:1032
_.extend._ensureElement backbone.js:1104
Backbone.View backbone.js:986
child backbone.js:1531
(anonymous function) pageLoader.js:19
(anonymous function)
Here is the JavaScript file
(function ($){
window.PageLoader = Backbone.View.extend({
el: $("section"),
events: {
"": "initialization",
"click #aboutUs" : "aboutUs",
},
initialization: function(){
console.log('pageLoader.js initialized\nHome page rendered');
},
aboutUs:function(){
console.log('About us page rendered.');
}
});
var pageLoader = new PageLoader();
//pageLoader.initialization();
//pageLoader.aboutUs();
})(jQuery);
Also here is the HTML
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/main.css">
<meta />
<meta />
<title>Bus tours and tows</title>
</head>
<body>
<div id="centerWrapper">
<header>
<h1>So and so Bus tours and tows</h1>
<header/>
<nav>
<ul>
<li><a href="">Home</a></li>
<li><a href="#aboutUs">About us</a></li>
<li><a href="">Tours</a></li>
<li><a href="">Tows</a></li>
<li><a href="">Schedule</a></li>
<li><a href="">Contact</a></li>
</ul>
</nav>
<section></section>
<footer> © Of So and so bus tours and tows. <br />
<i>Questions regarding the construction of the website, please email</i>
<a href="mailto: [email protected]">Web Master</a>
</footer>
<div id="jsFilesAndDepend">
<!-- -->
<!-- Filese that are dependant-->
<script src="js/dependencies/underscore.js"></script>
<script src="js/dependencies/backbone.js"></script>
<script src="js/dependencies/jquery-1.10.1.js"></script>
<script src="js/pageLoader.js"></script>
<script src=""></script>
<script src=""></script>
</div>
</div>
</body>
</html>
I am new to Backbone.JS. Thank you for helping.
I'm experimenting around with Backbone.js and am simply trying to get the messages to pop up on my console screen. How ever, every time I do so an error keeps on appearing (noted below)
Uncaught TypeError: Expecting a function in instanceof check, but got [object Object] backbone.js:1032
_.extend.setElement backbone.js:1032
_.extend._ensureElement backbone.js:1104
Backbone.View backbone.js:986
child backbone.js:1531
(anonymous function) pageLoader.js:19
(anonymous function)
Here is the JavaScript file
(function ($){
window.PageLoader = Backbone.View.extend({
el: $("section"),
events: {
"": "initialization",
"click #aboutUs" : "aboutUs",
},
initialization: function(){
console.log('pageLoader.js initialized\nHome page rendered');
},
aboutUs:function(){
console.log('About us page rendered.');
}
});
var pageLoader = new PageLoader();
//pageLoader.initialization();
//pageLoader.aboutUs();
})(jQuery);
Also here is the HTML
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/main.css">
<meta />
<meta />
<title>Bus tours and tows</title>
</head>
<body>
<div id="centerWrapper">
<header>
<h1>So and so Bus tours and tows</h1>
<header/>
<nav>
<ul>
<li><a href="">Home</a></li>
<li><a href="#aboutUs">About us</a></li>
<li><a href="">Tours</a></li>
<li><a href="">Tows</a></li>
<li><a href="">Schedule</a></li>
<li><a href="">Contact</a></li>
</ul>
</nav>
<section></section>
<footer> © Of So and so bus tours and tows. <br />
<i>Questions regarding the construction of the website, please email</i>
<a href="mailto: [email protected]">Web Master</a>
</footer>
<div id="jsFilesAndDepend">
<!-- -->
<!-- Filese that are dependant-->
<script src="js/dependencies/underscore.js"></script>
<script src="js/dependencies/backbone.js"></script>
<script src="js/dependencies/jquery-1.10.1.js"></script>
<script src="js/pageLoader.js"></script>
<script src=""></script>
<script src=""></script>
</div>
</div>
</body>
</html>
I am new to Backbone.JS. Thank you for helping.
Share Improve this question edited Jan 8, 2014 at 22:05 Lorenzo B 33.4k24 gold badges118 silver badges195 bronze badges asked Jun 26, 2013 at 20:15 Josh VJosh V 1232 silver badges10 bronze badges1 Answer
Reset to default 9You need to load jQuery before backbone,
<script src="js/dependencies/underscore.js"></script>
<script src="js/dependencies/jquery-1.10.1.js"></script>
<script src="js/dependencies/backbone.js"></script>
You also cannot define empty event key value pairs,
events: {
// "": "initialization", <- this is invalid.
"click #aboutUs" : "aboutUs",
},
本文标签: javascriptUncaught TypeError Expecting a function in instanceof checkStack Overflow
版权声明:本文标题:javascript - Uncaught TypeError: Expecting a function in instanceof check - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741488764a2381523.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论