I am just inserting
$(document).ready(function () {
alert("!!!");
});
as usually into
@{
ViewBag.Title = "Sign Up";
Layout = "~/Views/Shared/_WebSite.cshtml";
}
<script type="text/JavaScript">
$(document).ready(function () {
alert("!!!");
});
</script>
<h2>Sign Up</h2>
@using (Html.BeginForm())
{
@Html.ValidationSummary()
{
}
}
@section Scripts {
@Scripts.Render("~/bundles/jqueryval")
}
but I cannot see alert() message...
other things of jQuery are working fine at this page...
What do I am missing?
Any clue?
Thank you!
You can see jQuery is referenced after your code if you inspect the html.
Default project comes with an optional scripts section that will be rendered after jQuery reference in the layout, that's where your code should go.
@{
ViewBag.Title = "Sign Up";
Layout = "~/Views/Shared/_WebSite.cshtml";
}
<h2>Sign Up</h2>
@using (Html.BeginForm())
{
@Html.ValidationSummary()
{
}
}
@section Scripts {
<script type="text/JavaScript">
$(document).ready(function () {
alert("!!!");
});
</script>
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With