I have the following Asp.Net MVC 4 razor code at the end of the file.
.... @section Scripts { @Scripts.Render(\"~/bundles/jqueryval\") }
Your Script is called before the jquery is even loaded so it doesn't know what $ means. Try having the jquery scripts loaded in the head section of your layout file.