我想在我的asp .net视图中使用Jquery validate进行验证,但是该插件不起作用
我的html代码:
@using (Html.BeginForm("Save", "Organization",FormMethod.Post,new { enctype="multipart/form-data", id = "myform" })) {
<input type="text" name="username" placeholder="Username" />
</form>
}
脚本:
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery.validate.js"></script>
@section scripts{
@Scripts.Render("~/bundles/jqueryval")
<script>
$(document).ready(function () {
$('#myform').validate({
rules: {
username: {
required: true,
}
}
});
});
});