Tab click doesn't work


rookie

I tried following this demo https://www.youtube.com/watch?v=PP3x4crHBog but since I already named other tags I can't name the same thing, so I made some changes to the variable names and Using the skins and all the formatting, but whenever I click the login button, the display doesn't show the login form....what am I doing wrong?

$('.tabs a').on('click', function (e) {
              alert("in");
              e.preventDefault();

              $(this).parent().addClass('active');
              $(this).parent().siblings().removeClass('active');

              target = $(this).attr('href');

              $('.tabs-content > div').not(target).hide();
              $(target).fadeIn(600);
        });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <div class='forms'>
            <ul class='tabs-group'>
                <li class='tabs active'><a href="#signUp">Sign Up</a></li>
                <li class='tabs'><a href="#login">Login</a></li>
            </ul>

            <div class='tabs-content'>
                <div id='signUp'>
                    <h2 id='regTitle'>Register an account to get started!</h2>
                    <form id='regForm' name='regForm' method='POST' action='<?= BASE_URL ?>register/' style='display:block;'>
                        <table>
                            <tr>
                                <td><label for='regUsername'>Username</label></td>
                                <td><input id='regUsername' name='regUsername' type='text'></td>
                            </tr>
                            <tr>
                                <td><label for='regEmail'>Email</label></td>
                                <td><input id='regEmail' name='regEmail' type='email'></td>
                            </tr>
                            <tr>
                                <td><label for='regPassword'>Password</label></td>
                                <td><input id='regPassword' name='regPassword' type='password'></td>
                            </tr>
                        </table>
                      <input type="submit" value="Register" style='margin:10px;'>
                    </form>
                </div>
                <div id='login'>
                    <h2 id='loginTitle'>Welcome Back!</h2>
                    <form method="POST" action="<?= BASE_URL ?>login/">
                        <input type='text' id='username' name='username' placeholder='Username'>
                        <input type='password' id='password' name='password' placeholder='Password'>
                        <input type='submit' name='submit' value='Sign In'>
                    </form>
                </div>
            </div>
        </div>

random channel

https://jsfiddle.net/mhnaw7kv is a good answer. Yes, yes, so if you come across any new questions, just create a new one and I'll answer.

//I have nothing to say

Just make sure to declare jQuery in the <head>code tag , the current tag is <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>.

Also, just a quick note, when you declare <script>, you don't have to put it <script type="text/javascript">. <script>Even though jQuery is declared , Javascript is already declared in the function .

Related


Tab click doesn't work

rookie I tried to follow this demo https://www.youtube.com/watch?v=PP3x4crHBog but couldn't name the same since I already named other tags, so I made some changes to the variable names and Using the skins and all the formatting, but whenever I click the login

Ionic tab click doesn't work

gfels Sometimes I don't understand why the Ionic is so stiff. I have an input and a label stacked on top of each other: <ion-item> <ion-label stacked (click)="labelClick($event)" [innerHTML]="htmlString"></ion-label> <ion-input ></ion-input> And the labelCli

Click event doesn't work on tab

ask I have the following jsx code that doesn't work with mouseclicks: import React from 'react'; import Tabs from 'material-ui/lib/tabs/tabs'; import Tab from 'material-ui/lib/tabs/tab'; const Main = () => ( <div> <Tabs> <Tab label="Item One" >

Bootstrap tab click preventDefault doesn't work

Stacey I'm using bootstrap 3.3 and following the tabs in the documentation. The simplest code given in the documentation doesn't work for me and I can't figure out why. $('#mainTabs a').click(function (e) { e.preventDefault() console.lo

Bootstrap tab click preventDefault doesn't work

Stacey I'm using bootstrap 3.3 and following the tabs in the documentation. The simplest code given in the documentation doesn't work for me and I can't figure out why. $('#mainTabs a').click(function (e) { e.preventDefault() console.lo

Ionic tab click doesn't work

gfels Sometimes I don't understand why the Ionic is so stiff. I have an input and a label stacked on top of each other: <ion-item> <ion-label stacked (click)="labelClick($event)" [innerHTML]="htmlString"></ion-label> <ion-input ></ion-input> And the labelCli

Ionic tab click doesn't work

gfels Sometimes I don't understand why the Ionic is so stiff. I have an input and a label stacked on top of each other: <ion-item> <ion-label stacked (click)="labelClick($event)" [innerHTML]="htmlString"></ion-label> <ion-input ></ion-input> And the labelCli

Bootstrap tab click preventDefault doesn't work

Stacey I'm using bootstrap 3.3 and following the tabs in the documentation. The simplest code given in the documentation doesn't work for me and I can't figure out why. $('#mainTabs a').click(function (e) { e.preventDefault() console.lo

Bootstrap tab click preventDefault doesn't work

Stacey I'm using bootstrap 3.3 and following the tabs in the documentation. The simplest code given in the documentation doesn't work for me and I can't figure out why. $('#mainTabs a').click(function (e) { e.preventDefault() console.lo

Ionic tab click doesn't work

gfels Sometimes I don't understand why the Ionic is so stiff. I have an input and a label stacked on top of each other: <ion-item> <ion-label stacked (click)="labelClick($event)" [innerHTML]="htmlString"></ion-label> <ion-input ></ion-input> And the labelCli

Ionic tab click doesn't work

gfels Sometimes I don't understand why the Ionic is so stiff. I have an input and a label stacked on top of each other: <ion-item> <ion-label stacked (click)="labelClick($event)" [innerHTML]="htmlString"></ion-label> <ion-input ></ion-input> And the labelCli

Ionic tab click doesn't work

gfels Sometimes I don't understand why the Ionic is so stiff. I have an input and a label stacked on top of each other: <ion-item> <ion-label stacked (click)="labelClick($event)" [innerHTML]="htmlString"></ion-label> <ion-input ></ion-input> And the labelCli

Bootstrap tab click preventDefault doesn't work

Stacey I'm using bootstrap 3.3 and following the tabs in the documentation. The simplest code given in the documentation doesn't work for me and I can't figure out why. $('#mainTabs a').click(function (e) { e.preventDefault() console.lo

Ionic tab click doesn't work

gfels Sometimes I don't understand why the Ionic is so stiff. I have an input and a label stacked on top of each other: <ion-item> <ion-label stacked (click)="labelClick($event)" [innerHTML]="htmlString"></ion-label> <ion-input ></ion-input> And the labelCli

Chrome doesn't work with vuejs v-on: click on options tab

blank 94 I have something like the following code: <select> <option v-for="category in step4.categoryList" v-on:click="setCategoryId(category.id)"> @{{category.category_name }} </option> </select> It works fine in firefox but not in chrome and safari

Show Bootstrap tab loaded with Ajax on first click doesn't work

dirty encoder I am trying to load the content of a given tab using Ajax. I'm rendering the first tab active on the server, and the other tabs are active and loaded using Ajax. The problem I've isolated (without Ajax) is here . HTML: <h1>Hello, tabs!</h1> <div

Chrome doesn't work with vuejs v-on: click on options tab

blank 94 I have something like the following code: <select> <option v-for="category in step4.categoryList" v-on:click="setCategoryId(category.id)"> @{{category.category_name }} </option> </select> It works fine in firefox but not in chrome and safari

Chrome doesn't work with vuejs v-on: click on options tab

blank 94 I have something like the following code: <select> <option v-for="category in step4.categoryList" v-on:click="setCategoryId(category.id)"> @{{category.category_name }} </option> </select> It works fine in firefox but not in chrome and safari

Chrome doesn't work with vuejs v-on: click on options tab

blank 94 I have something like the following code: <select> <option v-for="category in step4.categoryList" v-on:click="setCategoryId(category.id)"> @{{category.category_name }} </option> </select> It works fine in firefox but not in chrome and safari

Show Bootstrap tab loaded with Ajax doesn't work on first click

dirty encoder I am trying to load the content of a given tab using Ajax. I'm rendering the first tab active on the server, and the other tabs are active and loaded using Ajax. The problem I've isolated (without Ajax) is here . HTML: <h1>Hello, tabs!</h1> <div

Left click on link doesn't work, but "open in new tab" works

rock degree I'm working on my personal website (built from a template) and when I'm done, my links stop responding to left clicks. They work fine if you right click and select "Open in New Tab". You can see the URL in the status bar at the bottom of the browse

Left click on link doesn't work, but "open in new tab" works

rock degree I'm working on my personal website (built from a template) and when I'm done my links stop responding to left clicks too. They work fine if you right click and select "Open in New Tab". You can see the URL in the status bar at the bottom of the bro

Load new content in tab when button click doesn't work

Queensland I try to load content into a tab when a button is clicked. But the code below takes me to the first tab. HTML code: <div class="tabbable"> <ul class="nav nav-tabs"> <li class="active"><a href="#overview" >Overview</a></li>

Chrome doesn't work with vuejs v-on: click on options tab

blank 94 I have something like the following code: <select> <option v-for="category in step4.categoryList" v-on:click="setCategoryId(category.id)"> @{{category.category_name }} </option> </select> It works fine in firefox but not in chrome and safari

Chrome doesn't work with vuejs v-on: click on options tab

blank 94 I have something like the following code: <select> <option v-for="category in step4.categoryList" v-on:click="setCategoryId(category.id)"> @{{category.category_name }} </option> </select> It works fine in firefox but not in chrome and safari

Chrome doesn't work with vuejs v-on: click on options tab

blank 94 I have something like the following code: <select> <option v-for="category in step4.categoryList" v-on:click="setCategoryId(category.id)"> @{{category.category_name }} </option> </select> It works fine in firefox but not in chrome and safari

Left click on link doesn't work, but "open in new tab" works

rock degree I'm working on my personal website (built from a template) and when I'm done my links stop responding to left clicks too. They work fine if you right click and select "Open in New Tab". You can see the URL in the status bar at the bottom of the bro

Load new content in tab when button click doesn't work

Queensland I try to load content into a tab when a button is clicked. But the code below takes me to the first tab. HTML code: <div class="tabbable"> <ul class="nav nav-tabs"> <li class="active"><a href="#overview" >Overview</a></li>

ng-click="tab=$index" doesn't work in angular

cubic I have this in my app: <li ng-repeat="name in tabs track by $index" ng-class="{selected: tab==$index}" ng-click="tab = $index">{{name}}</li> and it doesn't work, when i click on the item the selected class is enabled (every li clicked has the class, cli