I've created some basic scripts using jquery and when placed below the markup in one of my MVC views, it works fine. I wanted to move those scripts to a separate file in Scripts folder, so I have created a file called 'CustomJquery.js' and have placed it in the Scripts folder. I have created a bundle for it in 'BundleConfig.cs', but my scripts don't work anymore when called from my view using @Scripts.Render("~/bundles/CustomJquery"). I've even tried placing them in '_Layout.cshtml' but still no luck. Please see my code below. any help would be greatly appreciated. thanks
CustomJquery.js in Scripts folder
$("#Button").click(function () {
alert("hello");
});
Index.cshtml
<input id="Button" type="submit" value="Test" />
@Scripts.Render("~/bundles/CustomJquery")
BundleConfig.cs
bundles.Add(new ScriptBundle("~/bundles/CustomJquery").Include(
"~/Scripts/CustomJquery.js"));
Updated
Yes, I could see my 'CustomJquery.js' in the 'sources' tab of Google chrome tools.
I could see the script src in the markup as well, as per 'Elements' tab
<script src="/Scripts/CustomJquery.js"></script>
</section>
</div>
Please help