I watched a pdc session by Stephen Walther and in the presentation he was referencing the JQuery js file like the following:
<asp:ScriptManager id='sm1' runat='server'> <Scripts> <asp:ScriptReference Path='~/Scripts/JQuery.js' /> </Scripts> </asp:ScriptManager>
Is there a advantage or disadvantage to doing it the above way instead of just using a link in the head section of the page.
He was also putting the following into the javascript section of his sample pages to run JQuery:
<script type='text/javascript'> function pageLoad() { $(':text').css('background-color','yellow'); } </script>
Is the pageLoad necesary above? He mentioned that it is from the Microsoft AJAX library and it waits for the DOM to be finished loading, but I thought the $ symbol in JQuery is just a shorthand for waiting for the DOM to be finished loading.
$(document).ready() and pageLoad() are not the same!
http://encosia.com/2009/03/25/document-ready-and-pageload-are-not-the-same/
From the article:
pageLoad() is called just after the DOM has finished loading. this isn’t the only point at which pageLoad() is called though: It is also called after every partial postback.
In the case of initialization code that should run once, $(document).ready() is the ideal solution.