I have the following page:
<body>
<div id="menuBar"> </div>
<canvas id="myCanvas" width="700" height="700" style="border:1px solid #000000;"></canvas>
</body>
<script src="../Scripts/jQuery.mazeBoard.js"></script>
<script>
$(document).ready(function () {
var mazeArray = ...
$("#menuBar").load("/Views/UpperMenu.html");
$("#myCanvas").mazeBoard(mazeArray);
})
</script>
mazeBoard is a jQuery plugin defined in mazeBoard.js:
(function ($) {
$.fn.mazeBoard = function (mazeData) {
this.element = $(this)[0];
var context = this.element.getContext("2d");
draw on canvas...
return this;
}
})(jQuery);
Strangely, unless I delete the row $("#menuBar").load("/Views/UpperMenu.html") I get a "mazeboard is not a function" error. This error disappears when the row is deleted.
.mazeBoard()first, then.load().Views/UpperMenu.html? you may have<script>tags which interfere