【发布时间】:2014-04-08 02:24:27
【问题描述】:
我正在尝试使用 jquery 插件 validate() 方法来验证我当前的共享点可视 webpart 中的 div。
我不确定为什么这不起作用。它什么都不做。
这里是代码。
<div id="main" runat="server">
<h3>2. Select your study subject.<span class="red">*</span></h3>
<asp:RadioButtonList CssClass="required" ID="rdb_study_popul" runat="server" OnSelectedIndexChanged="rdb_study_popul_SelectedIndexChanged">
<asp:ListItem>Individuals</asp:ListItem>
<asp:ListItem>Population</asp:ListItem>
</asp:RadioButtonList>
</div>
<asp:Button ID="btn_studysubject_section" runat="server" CssClass="WBSButtonhide" OnClick="btn_studysubject_section_Click"
Text="Next"/>
这里是 jquery
$("input[type='submit']").click(function () {
if ($(this).val() != 'Back') {
var names = [];
var info = " ";
$('#<%= main.ClientID %>').validate({
rules:
{
<%= rdb_study_popul.ClientID%> : { required: true }
},
messages:
{
<%= rdb_study_popul.ClientID%> : "This field cannot be empty, please enter between"
}
});
}
});
【问题讨论】:
标签: javascript jquery asp.net web-parts