When I submit a form which includes a text field with a "maxlength" attribute using ajax, I get a javascript error: Uncaught SyntaxError: Unexpected token u (jquery-1.9.1.min.js:3)
If I remove the maxlength attribute everything runs fine.
My HTML, stripped down my page to the bare minimum to replicate the issue:
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script src="/Scripts/jquery.unobtrusive-ajax.js"></script>
<script src="/Scripts/jquery.validate.js"></script>
<script src="/Scripts/jquery.validate.unobtrusive.js"></script>
</head>
<body>
<form action="#" data-ajax="true" id="form0" method="post">
<input id="deposit" name="numberValue" type="text" class="despositInput" maxlength="8" value="1000">
<input type="submit" value="go">
</form>
</body>
</html>
Can't work out what I'm doing wrong - perhaps the jquery scripts provided by the template from visual studio are incompatible? I'd appreciate any help, thanks.
maxlength
triggers the issue here the real problem is to do with "unobtrusive" validation in general, rather than specific to themaxlength
property. – Bingen