Skip to content

Instantly share code, notes, and snippets.

/Index.html

Created Sep 5, 2013
Embed
What would you like to do?
RequireJS with multiple functions - how to call a function. Getting "undefined is not a function" error
...
<script data-main="" src="libraries/require.js"></script>
<script type="text/javascript">
//function that get's called on body onload
define('loadPage', ['hideAllDivs'], function createLoadPage()
{
return function loadPage()
{
console.log("here");
hideAllDivs();
};
});
//hide all divs
define('hideAllDivs', [], function()
{
return function hideAllDivs()
{
console.log("hi");
};
});
require(['libraries/jquery-1.10.2.min', 'loadPage'], function(loadPage) {
$(function() {
loadPage(); //****Getting "undefined is not a function" at THIS line*******//
console.log("hello");
});
});
</script>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment