我正在使用 jQuery 显示和隐藏函数来呈现额外的表单信息。我还使用 MultiView 在表单的多个页面之间切换。我一直在回顾一些关于 jQuery Cookie 的内容,但不确定如何实现代码。
我的显示和隐藏功能正常工作,我只需要弄清楚如何实现 Cookie。-谢谢
jQuery 脚本:
<script type="text/javascript">
$(function () {
$('.thirdPartyForm').hide();
$('#thirdPartyService').click(function () {
if ($(this).is(':checked')) {
$(".thirdPartyForm").show();
} else {
$(".thirdPartyForm").hide();
}
});
$('.emsSection').hide();
$('#emsYES').click(function () {
$('.emsSection').show();
$.cookie('.emsSection');
});
$('#emsNO').click(function () {
$('.emsSection').hide();
});
});
</script>
HTML(复选框)
<!-- CUSTOMER OPTIONS TABLE -->
<table id="customerOptionsTable">
<tr>
<td colspan="4"><p>Customer Options</p></td>
</tr>
<tr>
<td class="cotTd">HVAC Service</td>
<td class="chkbx"><asp:CheckBox ID="hvacService" runat="server" /></td>
<td class="cotTd">Third Party Site</td>
<td class="chkbx"><asp:CheckBox ID="thirdPartyService" runat="server" /></td>
</tr>
<tr>
<td colspan="4"><!-- SPACER --></td>
</tr>
</table>
HTML(将根据检查显示或隐藏的表单部分)
<tr>
<td class="thirdPartyForm">
Third Party Name (Website Name):
<asp:TextBox ID="thirdPartyName" CssClass="txtbx" runat="server"></asp:TextBox>
Phone Number:
<asp:TextBox ID="thirdPartyNumber" CssClass="txtbx phoneMask" runat="server"></asp:TextBox>
IVR Phone Number:
<asp:TextBox ID="thirdPartyIVR" CssClass="txtbx" runat="server"></asp:TextBox>
User Name:
<asp:TextBox ID="thirdPartyUserName" CssClass="txtbx" runat="server"></asp:TextBox>
</td>
<td class="thirdPartyForm">
Third Party Site Address:
<asp:TextBox ID="thirdPartyAddy" CssClass="txtbx" runat="server"></asp:TextBox>
Secondary Phone Number (if applicable):
<asp:TextBox ID="thirdPartySecondPhone" CssClass="txtbx phoneMask" runat="server"></asp:TextBox>
PIN Number:
<asp:TextBox ID="thirdPartyPIN" CssClass="txtbx" runat="server"></asp:TextBox>
Password:
<asp:TextBox ID="thridPartyPassword" CssClass="txtbx" runat="server"></asp:TextBox>
</td>
</tr>