I am trying to use jquery validation, but for some reason no error message shows up, even though I try to follow various examples:
<form action="/" id="paaForm" method="post">
<input type="text" name="testMe" id="testMe" />
<button id="btnSubmit" type="button" value="Save" class="btn btn-default" />
jquery:
$(function () {
$("#paaForm").validate({
rules: {
testMe: {
required: true
},
...
$('#btnSubmit').on('click', submit);
...
function submit() {
if (!$("#paaForm").valid()) {
return;
}
...
EDITED:
I have to add more information. My application is an MVC application, so it uses bundling like this:
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));
This way, MVC validation based on model attributes works perfectly. But I need more complex validation, that is why I added simple jquery validation. And it doesn't work, as I mentioned above. But if I replace bundling with this one,
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate.js"));
jquery validation works, but MVC validation doesn't work, because I exclude "~/Scripts/jquery.validate.unobtrusive.js". Is it possible to make both work?