I'm trying to run a jquery code which was put in my _Layout.cshtml as below:
...............
<script type='text/javascript'>
$(document).ready(function () {
alert('Test');
});
</script>
@Scripts.Render("~/bundles/jquery")
@RenderSection("Scripts", required: false)
</body>
</html>
The above code wasn't fired and when I inspected with Chrome Dev, it showed $ is not defined ( I can see all my jquery, jquery ui files are loaded )
It worked if I put this code in an external js file
I don't mind putting all my jquery code in external files, but really wanna clarify where I am doing wrong.