<script type="text/javascript" src="/static/admin/lib/jquery/1.9/jquery.js"></script>
<script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/static/admin/lib/jquery.validation/1.14.0/additional-methods.js"></script>
<form id="myform" method="post" action="">
<div class="left">
<p class="item">
<label class="item_title" for="t_phone">:</label>
<!-- idname -->
<input id="t_phone" name="t_phone" class="input-text" type="text" />
<div class="item">
<label for="selected_1" class="item_title">:</label>
<select id="selected_1" name="selected_1" title="Please select something!">
<option value=""></option>
<option value=""></option>
<option value=""></option>
</select>
</div>
<div class="item">
<label for="selected_2" class="item_title {required:true}">:</label>
<select id="selected_2" name="selected_2" title="Please select something!">
<option value=""></option>
<option value=""></option>
<option value=""></option>
</select>
</div>
<div class="item">
<label class="item_title">:</label>
<label for="genderA" class="gender_label">
<input type="radio" id="genderA" value="m" name="gender" />
</label>
<label for="genderB" class="gender_label">
<input type="radio" id="genderB" value="f" name="gender" />
</label>
</div>
<div class="right">
<p class="item">
<label class="item_title" for="t_user">:</label>
<!-- -->
<input id="t_user" name="t_user" class="input-text" type="text" />
</div>
<div class="submits">
<input class="submit btn btn-primary radius" type="submit" value="" />
</div>
</form>
<script>
$("-sharpmyform").validate({
debug: true, //submit
//errorClass: "label.error", //:error
focusInvalid: false, //false
onkeyup: false,
//ignore: "",//select
submitHandler: function (form) { //,:form
alert("");
form.submit(); //
},
rules: {
phone: {
required: true
},
user: {
required: true,
},
gender: {
required: true
},
selected_1: {
required: true
},
selected_2: {
required: true
}
},
messages: {
phone: {
required: ""
},
user: {
required: ""
},
gender: {
required: "option 111"
},
selected_1: {
required: "selected 111"
},
selected_2: {
required: "selected 222"
}
}
});
</script>