I have the code as shown below. Have removed unwanted code from this, just wrote what was needed. When I call my toggleFunc from inline script in body, it shown in console that this function is not defined. Can anyone please tell me whats wrong with this?
<head>
<script src="~/Client/js/lib/jquery-1.10.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var pageInitialize = function () {
..doing something here
function toggleFunc() {
..doing something more here
};
};
pageInitialize();
});
</script>
</head>
<body>
<script>toggleFunc()</script>
</body>
toggleFunc()gets called before it is defined.