@Ajax is not being recognized in razor views for my MVC application. I believe the reason is bc Unobtrusive Javascript isn't allowed for the newest version of VS Mac?
To fix this problem "the web" advises adding below to the web.config of the project.
enable unobtrusive JS screenshot
However .Net Core doesn't have that, now has appsettings.json, which looks like this:
Anyone know how to allow unobtrusive-Javascript in JSON?
In Asp.Net core, When you use the input tag helpers to generate the input fields, it does generate the html 5 attributes on those inputs used by jQuery validate & unobtrusive validate plugin, based on the data annotations you have on your view model properties. As long as you include the needed 2 javascript files in your page, the client side validation will work. You do not need any web config setting or anything like that.
Just include these 2 files to your page/layout
Assuming the 2 files exist in the js directory in the static content root (
wwwrootdirectory by default) Assuming you also have thespanelement for showing the validation errors along with your inputs.These 2 files are dependent on jQuery. So make sure you included that script as well.