I try to composite scripts using this code :
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script>
$(document).ready(function () {
alert("asd");
});
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:ScriptManager runat="server" ID="scMan1">
<CompositeScript>
<Scripts>
<asp:ScriptReference Path="~/Scripts/jquery-1.4.1.js" />
</Scripts>
</CompositeScript>
</asp:ScriptManager>
</asp:Content>
Seems It works fine because in HTML generated source script tag exist that contains jQuery.
<script src="/WebSite2/ScriptResource.axd?d=hX0MDGfWoeBxqyrCFnUlb_i8FIXYFH2jSHZZ8wsoh3wFhHjdmAfUYtPy5B129cjGB7udx4AYPQm_cJi8Xf7uSMn9bbw2gWuhnKTab4SQhBy8ulESCXITgKubR2QozYUq-EPeVYNsCW4jU_8hY-J9fA2" type="text/javascript"></script>
But jQuery does not work now.
When I reference script usually jQuery works.
What am i doing wrong? Thanks a lot
My master page looks like this:
I then add my scripts to
EndPagearea.I’ve included the standard jQuery setup for ajax in here too.
Original answer.
It looks like you have the order wrong. jQuery needs to be first — in your example you have the code that is using jQuery in the header and jQuery itself in the body.