According to this post Click here to see the referred post
I tried to get access to a function which is defined in another .js file following the post instruction. However, I still have a problem. See my code below:
sildemenu.js
$(document).ready(function() {
var window.slideMenu=function(){
//do something here
}();
});
control.js
$(document).ready(function() {
$('#foo').on('click', function() {
window.slideMenu();
});
});
I got the error "Object [object Window] has no method 'sildeMenu' ". I am very new in programming. Please give me a mercy.
sildemenu.jsfails becausevar window.slideMenuis a syntax error (and the issue gdoron mentions). Drop thevar. I recommend to read netmagazine.com/tutorials/javascript-debugging-beginners.()after the function definition and novarbeforewindow.....