【发布时间】:2017-02-04 14:12:26
【问题描述】:
你好,我开发了一个表单,里面有输入框和选择框。我想对选择框和输入框进行验证。我只能对输入框进行验证。我无法对带有输入框的选择框进行验证。
$(document).ready(function(){
$("#myform").validate();
});
<script src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
<form action="#" id="myform">
<label class="label1 col-md-4">Enter Template Name
<span class="required"> * </span>
</label>
<input id="templateName" type="text" data-required="1" class="form-control" />
</br>
<label class="label1 col-md-4">Enter Admission Year
<span class="required"> * </span>
</label>
<input id="admissionYear" type="text" data-required="1" maxlength="4" />
</br>
<label class="label1 col-md-4">Select the type of eligibility
<span class="required"> * </span>
</label>
<select id="reportsSelect" class="form-control" data-placeholder="Select" tabindex="1">
<option value="0">Choose</option>
<option value="overall">Overall</option>
<option value="specific">Specific subject</option>
</select>
</br>
<button type="button">Submit</button>
</form>
【问题讨论】:
-
你的代码在哪里?对输入框进行验证的那个。
-
请分享你的javascript代码?
-
我已经包含了 javascript 代码。寻找一些好的建议
标签: javascript jquery css validation