单击链接javascript asp.net时如何更改活动班级

时间:2019-02-15 11:30:16

标签: javascript html asp.net-mvc

听到我的登录和登录代码,我正在使用Asp.net single Action进行登录和注册,如何在单击“注册”时将“活动”选项卡类更改为SiginUp选项卡内容,然后单击“登录”按钮,将弹出登录内容。

<a href="@Url.Action("SignInSigInUp","Home", new {})" data-toggle-modal="modal" id="btnsignup" class="btn">SignUp</a>

<a href="@Url.Action("SignInSigInUp","Home", new {})" data-toggle-modal="modal" id="btnLogin" class="btn">Login</a>

$(function() {
  var tab = $('.tabs h3 a');
  tab.on('click', function(event) {
    event.preventDefault();
    tab.removeClass('active');
    $(this).addClass('active');
    tab_content = $(this).attr('href');
    $('div[id$="tab-content"]').removeClass('active');
    $(tab_content).addClass('active');
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

<body>
  <!-- LOGIN MODULE -->
  <div class="login">
    <div class="wrap">
    </div>

    <!-- LOGIN FORM -->
    <div class="user">
     
      <div class="form-wrap">
        <!-- TABS -->
        <div class="tabs">
          <h3 class="login-tab"><a class="log-in active" href="#login-tab-content"><span>Login<span></a></h3>
          <h3 class="signup-tab"><a class="sign-up" href="#signup-tab-content"><span>Sign Up</span></a></h3>
        </div>
        <!-- TABS CONTENT -->
        <div class="tabs-content">
          <!-- TABS CONTENT LOGIN -->
          <div id="login-tab-content" class="active">
            <form class="login-form" action="" method="post">
              <input type="text" class="input" id="user_login" autocomplete="off" placeholder="Email or Username">
              <input type="password" class="input" id="user_pass" autocomplete="off" placeholder="Password">
              <input type="checkbox" class="checkbox" checked id="remember_me">
              <label for="remember_me">Remember me</label>
              <input type="submit" class="button" value="Login">
            </form>

          </div>
        </div>
        <!-- TABS CONTENT SIGNUP -->
        <div id="signup-tab-content">
          <form class="signup-form" action="" method="post">
            <input type="email" class="input" id="user_email" autocomplete="off" placeholder="Email">
            <input type="text" class="input" id="user_name" autocomplete="off" placeholder="Username">
            <input type="password" class="input" id="user_pass" autocomplete="off" placeholder="Password">
            <input type="submit" class="button" value="Sign Up">
          </form>
        </div>

0 个答案:

没有答案