In my custom masterpage i have this
<SharePoint:ScriptLink runat="server" name="~SiteCollection/Style Library/js/jquery-1.12.4.min.js" language="javascript" />
<SharePoint:ScriptLink runat="server" name="~SiteCollection/Style Library/js/BindMENU.js" language="javascript" />
and few lines below that i have this
<script type="text/javascript">
jQuery(function($) {
$('#MenuH .MenuBar ul.root').BindMENU({ MenuStyle:"DefaultMenu",Orientation:"Horizontal" });
});
</script>
In case you are wondering i am using a jquery function BindMenu which I is defined within the BindMENU.js file which i loaded earlier via SharePoint:ScriptLink
On loading the page I get this error -
BUT If i put the call to BindMenu.js in a document.write like this
<script type="text/javascript">
document.write("<script type='text/javascript' src='"+path+"js/BindMENU.js'><" + "/script>");
</script>
THEN the error goes away
I am not sure why this is occurring.
What is the difference using SharePoint:Scriptlink and using document.write to reference a Jquery/JavaScript function?
Can anybody here offer any insight ?
