You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
janjongboom edited this page Aug 29, 2011
·
1 revision
Because Moth's Javascript engine encourages you to put javascript files at the bottom of the page, Moth includes a HTML helper to put inline javascript that you declare in your (partial) views, at the bottom of the page; after you have registered 3rd party libraries. Even better: the javascript is automatically minified.
Write javascript that is dependent on a 3rd party module
For example, in your masterpage you have registered jQuery and rendered the requests at the bottom of your page (see Javascript). In one of your partial views you want to write some code that needs jQuery:
// this code will fail because jQuery wasn't loaded yet
$(function () {
$('p').addClass('yellow');
});
If you wrap your code in a Html.BeginScript tag, you can render this piece of script at the bottom of your page: