I am attempting to make a similar page to this.
The problem is that I can't use the external JS file in ASP.net (as far as I know) so I am defining the functions and trying to use them in the HTML page.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="authenticate.aspx.cs" Inherits="authenticate" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Flitter Authentication</title>
<link href="AuthenticationStyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="form">
<ul class="tab-group">
<li class="tab active" onclick="SwitchTab(e)"><a href="#signup">Sign Up</a></li>
<li class="tab" onclick="SwitchTab(e)"><a href="#login">Log In</a></li>
</ul>
<div class="tab-content">
<div id="signup">
<h1>Sign Up for Free</h1>
<form action="/" method="post">
<div class="top-row">
<div class="field-wrap">
<label>
First Name<span class="req">*</span>
</label>
<input type="text" required="required" autocomplete="off" />
</div>
<div class="field-wrap">
<label>
Last Name<span class="req">*</span>
</label>
<input type="text" required="required" autocomplete="off" />
</div>
</div>
<div class="field-wrap">
<label>
REQFIELD<span class="req">*</span>
</label>
<input required="required" autocomplete="off" />
</div>
<div class="field-wrap">
<label>
Set A Password<span class="req">*</span>
</label>
<input type="password" required="required" autocomplete="off" />
</div>
<button type="submit" class="button button-block" />Get Started
</form>
</div>
<div id="login">
<h1>Welcome Back!</h1>
<form action="/" method="post">
<div class="field-wrap">
<label>
REQFIELD<span class="req">*</span>
</label>
<input required="required" autocomplete="off" />
</div>
<div class="field-wrap">
<label>
Password<span class="req">*</span>
</label>
<input type="password" required="required" autocomplete="off" />
</div>
<p class="forgot"><a href="#">Forgot Password?</a></p>
<button class="button button-block" />Log In
</form>
</div>
</div>
<!-- tab-content -->
</div>
<!-- /form -->
<script>
function SwitchTab(e) {
e.preventDefault();
$(this).parent().addClass('active');
$(this).parent().siblings().removeClass('active');
target = $(this).attr('href');
$('.tab-content > div').not(target).hide();
$(target).fadeIn(600);
};
</script>
</body>
</html>
Some things I noticed: in on the onclick events I am using SwitchTab(e) I am sure that e is nothing in that context but I am not sure what I should be using. The script (defined at the bottom) should switch the views on the tab group.
ein this case means click event. It is automatically passed into the function on click. The only reason your function needs it is to prevent the default action of the click, and the<li>element has no default action. So you can get rid ofeande.preventDefault()and try that. However, if your function isn't being called at all, that's a bigger issue, and should be investigated withconsole.logand somesuch.