如何禁用手风琴标签?

时间:2015-09-09 10:31:41

标签: jquery asp.net

我想要禁用发货标签。当它打开时意味着如果我填写结算信息标签中的所有详细信息而没有错误,如电子邮件验证,必填字段等等。我填写所有正确的值然后单击运输信息选项卡然后只打开。否则我不想要打开运输tab.it应该被禁用。  看图:    enter image description here

<div id="accordion-container accordion-header_Static " class="checkout-accordion">
   <h2 id="h2login" class="accordion-header">Login</h2>
   <h2 id="h2BillingInformatio" class="accordion-header accordion-header_Static">Billing Information</h2>
   <div id="divBillingInformatio" class="accordion-content">
      <div class="row">
         <div class="col-md-6">
            <label>First Name <span>*</span></label>
            <asp:TextBox ID="txtFirstName" onkeyup="chkSameAs_OnCheckChanged()" runat="server" ClientIDMode="Static"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" Text=""
               SetFocusOnError="true" ControlToValidate="txtFirstName" ValidationGroup="Bill"
               CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
         </div>
         <div class="col-md-6">
            <label>Last Name <span>*</span></label>
            <asp:TextBox ID="txtLastName" onkeyup="chkSameAs_OnCheckChanged()" runat="server" ClientIDMode="Static"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" Text=""
               SetFocusOnError="true" ControlToValidate="txtLastName" ValidationGroup="Bill"
               CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
         </div>
      </div>
      <label>Company Name</label>
      <asp:TextBox ID="txtCompany" runat="server" onkeyup="chkSameAs_OnCheckChanged()" ClientIDMode="Static"></asp:TextBox>
      <label>Address <span>*</span></label>
      <asp:TextBox ID="txtAddressLine1" onkeyup="chkSameAs_OnCheckChanged()" runat="server" placeholder="Street Address" ClientIDMode="Static"></asp:TextBox>
      <asp:RequiredFieldValidator ID="rfvAddressLine1" runat="server" Text=""
         SetFocusOnError="true" ControlToValidate="txtAddressLine1" ValidationGroup="Bill"
         CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
      <asp:TextBox ID="txtAddressLine2" onkeyup="chkSameAs_OnCheckChanged()" runat="server" ClientIDMode="Static" placeholder="Apartment, suite, unit, etc. (if applicable)"></asp:TextBox>
      <div class="row">
         <div class="col-md-6">
            <label>City <span>*</span></label>
            <asp:TextBox ID="txtCity" onkeyup="chkSameAs_OnCheckChanged()" runat="server" ClientIDMode="Static"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvCity" runat="server" Text="City is required" ControlToValidate="txtCity"
               SetFocusOnError="true" ValidationGroup="Bill" CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
         </div>
         <div class="col-md-3">
            <asp:UpdatePanel ID="upCountry" runat="server" UpdateMode="Conditional">
               <ContentTemplate>
                  <div id="pStateFields" runat="server" visible="true">
                     <label>State<span>*</span></label>
                     <asp:DropDownList ID="ddlState" onchange="chkSameAs_OnCheckChanged()" ClientIDMode="Static" CssClass="select" runat="server" DataTextField="Name" DataValueField="StateRowId" ForeColor="#000">
                     </asp:DropDownList>
                     <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Text=""
                        SetFocusOnError="true" ControlToValidate="ddlState" ValidationGroup="Bill"
                        InitialValue="" CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
                     <br />
                  </div>
               </ContentTemplate>
            </asp:UpdatePanel>
         </div>
         <div class="col-md-3">
            <label>Zip <span>*</span></label>
            <asp:TextBox ID="txtZip" onkeyup="chkSameAs_OnCheckChanged()" onkeypress="return OnlyNumber(event,this.id);" runat="server" CssClass="inputTxt" ClientIDMode="Static"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvZip" runat="server" Text="Zip is required" ControlToValidate="txtZip"
               SetFocusOnError="true" ValidationGroup="Bill" CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Text="ZipCode must be numeric"
               SetFocusOnError="true" ControlToValidate="txtZip" ValidationGroup="Bill" CssClass="QtyError"
               Display="Dynamic" ValidationExpression="^\d*$"></asp:RegularExpressionValidator>
            <br />
         </div>
      </div>
      <div class="row">
         <div class="col-md-6">
            <label>Email <span>*</span></label>
            <asp:TextBox ID="txtEmail" onkeyup="chkSameAs_OnCheckChanged()" runat="server" CssClass="inputTxt" ClientIDMode="Static" autocomplete="off"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvEmail" runat="server" Text=""
               SetFocusOnError="true" ControlToValidate="txtEmail" ValidationGroup="Bill"
               CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="revEmail" runat="server" Text="Email is in invalid format"
               SetFocusOnError="true" ControlToValidate="txtEmail" ValidationGroup="Bill"
               Display="Dynamic" CssClass="QtyError" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
         </div>
         <div class="col-md-6">
            <label>Phone <span>*</span></label>
            <asp:TextBox ID="txtPhone" onkeyup="chkSameAs_OnCheckChanged()" runat="server" CssClass="inputTxt" ClientIDMode="Static"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvPhone" runat="server" Text=""
               SetFocusOnError="true" ControlToValidate="txtPhone" ValidationGroup="Bill"
               CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
         </div>
      </div>
   </div>
   <h2 id="h2ShippingInformatio" class="accordion-header accordion-header_Static" onclick="shippingTab();">Shipping Information</h2>
   <div id="divShippingInformatio" class="accordion-content second-row">
      <%--<input id="ShippingCheck" type="checkbox" checked onclick="chkSameAs_OnCheckChanged()" />--%>
      <asp:CheckBox ID="ShippingCheck" runat="server" ClientIDMode="Static" onclick="chkSameAs_OnCheckChanged()" />
      <asp:HiddenField ID="hfchkShippingCheck" runat="server" ClientIDMode="Static" />
      <label>&nbsp;Same as Billing Address</label>
      <br />
      <br />
      <fieldset id="ShippingForm" disabled runat="server" clientidmode="static">
         <div class="row">
            <div class="col-md-6">
               <label>First Name <span>*</span></label>
               <asp:TextBox ID="txtshipInfoFirstName" runat="server" ClientIDMode="Static"></asp:TextBox>
               <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" Text=""
                  SetFocusOnError="true" ControlToValidate="txtshipInfoFirstName" ValidationGroup="Ship"
                  CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
            </div>
            <div class="col-md-6">
               <label>Last Name <span>*</span></label>
               <asp:TextBox ID="txtshipInfoLastName" runat="server" ClientIDMode="Static"></asp:TextBox>
               <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" Text=""
                  SetFocusOnError="true" ControlToValidate="txtshipInfoLastName" ValidationGroup="Ship"
                  CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
            </div>
         </div>
         <label>Company Name</label>
         <asp:TextBox ID="txtShipInfoCompany" runat="server" ClientIDMode="Static"></asp:TextBox>
         <label>Address <span>*</span></label>
         <asp:TextBox ID="txtshipInfoAddressLine1" runat="server" ClientIDMode="Static" placeholder="Street Address"></asp:TextBox>
         <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" Text=""
            SetFocusOnError="true" ControlToValidate="txtshipInfoAddressLine1" ValidationGroup="Ship"
            CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
         <asp:TextBox ID="txtshipInfoAddressLine2" runat="server" ClientIDMode="Static" placeholder="Apartment, suite, unit, etc. (if applicable)"></asp:TextBox>
         <div class="row">
            <div class="col-md-6">
               <label>City <span>*</span></label>
               <asp:TextBox ID="txtshipInfoCity" runat="server" ClientIDMode="Static"></asp:TextBox>
               <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" Text=""
                  SetFocusOnError="true" ControlToValidate="txtshipInfoCity" ValidationGroup="Ship"
                  CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
            </div>
            <div class="col-md-3">
               <label>State<span>*</span></label>
               <asp:UpdatePanel ID="upShipInfoCountry" runat="server" UpdateMode="Conditional">
                  <ContentTemplate>
                     <div id="p1" runat="server" visible="true">
                        <asp:DropDownList ID="ddlShipInfoState" ClientIDMode="Static" CssClass="select" runat="server" DataTextField="Name" DataValueField="StateRowId" ForeColor="#000">
                        </asp:DropDownList>
                        <asp:RequiredFieldValidator ID="rfvddlShipInfoState" runat="server" Text=""
                           SetFocusOnError="true" ControlToValidate="ddlShipInfoState" ValidationGroup="Ship"
                           InitialValue="" Display="Dynamic"></asp:RequiredFieldValidator>
                        <br />
                     </div>
                  </ContentTemplate>
               </asp:UpdatePanel>
            </div>
            <div class="col-md-3">
               <label>Zip <span>*</span></label>
               <asp:TextBox ID="txtShipInfoZip" runat="server" ClientIDMode="Static" onchange="StateTaxBind()" onkeypress="return OnlyNumber(event,this.id);"></asp:TextBox>
               <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" Text=""
                  SetFocusOnError="true" ControlToValidate="txtShipInfoZip" ValidationGroup="Ship"
                  CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
               <asp:RegularExpressionValidator ID="revQuantity" runat="server" Text="ZipCode must be numeric"
                  SetFocusOnError="true" ControlToValidate="txtShipInfoZip" ValidationGroup="Ship" CssClass="QtyError"
                  Display="Dynamic" ValidationExpression="^\d*$"></asp:RegularExpressionValidator>
            </div>
         </div>
         <div class="row">
            <div class="col-md-6">
               <label>Email <span>*</span></label>
               <asp:TextBox ID="txtShipInfoEmail" runat="server" ClientIDMode="Static" onkeyup="errortxtShipInfoEmails()"></asp:TextBox>
               <span id="errortxtShipInfoEmail" class="QtyError" style="display: none"></span>
               <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" Text=""
                  SetFocusOnError="true" ControlToValidate="txtShipInfoEmail" ValidationGroup="Ship"
                  CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
               <%--asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" Text="Email is in invalid format"
                  SetFocusOnError="true" ControlToValidate="txtShipInfoEmail" ValidationGroup="Ship"
                  Display="Dynamic" CssClass="QtyError" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></%--asp:RegularExpressionValidator>--%>
               <asp:RegularExpressionValidator ID="rgvdfd" runat="server" ControlToValidate="txtShipInfoEmail" Text="email is in invalid format" CssClass="QtyError" ValidationGroup="Ship" SetFocusOnError="true" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" Display="Dynamic"> </asp:RegularExpressionValidator>
            </div>
            <div class="col-md-6">
               <label>Phone <span>*</span></label>
               <asp:TextBox ID="txtShipInfoPhone" runat="server" ClientIDMode="Static"></asp:TextBox>
               <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" Text=""
                  SetFocusOnError="true" ControlToValidate="txtShipInfoPhone" ValidationGroup="Ship"
                  CssClass="QtyError" Display="Dynamic"></asp:RequiredFieldValidator>
            </div>
         </div>
      </fieldset>
   </div>
</div>

Jquery的:

$('.accordion-header').toggleClass('inactive-header');

Open The First Accordion Section When Page Loads
$('.accordion-header').first().toggleClass('active-header').toggleClass('inactive-header');
$('.accordion-content').first().slideDown().toggleClass('open-content');

// The Accordion Effect
$('.accordion-header').on('click', function () {
    if ($(this).is('.inactive-header')) {
        $('.active-header').toggleClass('active-header').toggleClass('inactive-header').next().slideToggle().toggleClass('open-content');
        $(this).toggleClass('active-header').toggleClass('inactive-header');
        $(this).next().slideToggle().toggleClass('open-content');
        //alert('0');
    }

    else {
        $(this).toggleClass('active-header').toggleClass('inactive-header');
        $(this).next().slideToggle().toggleClass('open-content');
        //alert('1');
    }
});

0 个答案:

没有答案