Set specific href for each tab
Hi. I want to set my href for each tab. Here's my code:
-
- <ul class="category-account">
- <li class="tablinks" onclick="openTab(event, 'Home')" id="defaultOpen"><a href="#home" class="justify-content-between align-items-center d-flex"><h6><i class="fa fa-cogs" style="width: 20px;"></i>General</h6></a></li>
- <li class="tablinks" onclick="openTab(event, 'Logsec')"><a href="#logsec" class="justify-content-between align-items-center d-flex"><h6><i class="fa fa-shield" style="width: 20px;"></i>Login Security</h6></a></li>
- <li class="tablinks" onclick="openTab(event, 'Privacy')"><a href="#privacy" class="justify-content-between align-items-center d-flex"><h6><i class="fa fa-user-secret" style="width: 20px;"></i>Privacy</h6></a></li>
- <li class="tablinks" onclick="openTab(event, 'Notif')"><a href="#notif" class="justify-content-between align-items-center d-flex"><h6><i class="fa fa-bell-o" style="width: 20px;"></i>Notifications</h6></a></li>
- <li class="tablinks" onclick="openTab(event, 'Ads')"><a href="#ads" class="justify-content-between align-items-center d-flex"><h6><i class="fa fa-flag" style="width: 20px;"></i>Ads</h6></a></li>
- <li class="tablinks" onclick="openTab(event, 'Payment')"><a href="#payment" class="justify-content-between align-items-center d-flex"><h6><i class="fa fa-credit-card" style="width: 20px;"></i>Payment</h6></a></li>
- <li class="tablinks" onclick="openTab(event, 'Support')"><a href="#support" class="justify-content-between align-items-center d-flex"><h6><i class="fa fa-envelope-o" style="width: 20px;"></i>Give a Support</h6></a></li>
- </ul>
- <div id="Home" class="tabcontent" style="margin-left: 30%">
- <h4 class="title">Account</h4>
- <form class="form-area " id="myForm" action="mail.php" method="post" class="contact-form text-right">
- <div class="row">
- <div class="col-lg-8 form-group">
- <label>First Name</label><input disabled value="<?php echo $userRow['first_name']; ?>" class="common-input mb-20 form-control" required="" type="text">
- <label>Last Name</label><input disabled value="<?php echo $userRow['last_name']; ?>" class="common-input mb-20 form-control" required="" type="text">
- <label>Email</label><input disabled value="<?php echo $userRow['email']; ?>" class="common-input mb-20 form-control" required="" type="email">
- <label>Username</label><input disabled value="<?php echo $userRow['username']; ?>" class="common-input mb-20 form-control" required="" type="text">
- <label>Password</label><input disabled value="<?php echo $userRow['password']; ?>" class="common-input mb-20 form-control" required="" type="password">
- <button onclick="window.location.href = 'profile-edit.php';" class="primary-btn mt-20 text-white" style="float: right;">Save</button>
- <div class="mt-20 alert-msg" style="text-align: left;"></div>
- </div>
- </div>
- </form>
- </div>
- <div id="Logsec" class="tabcontent" style="margin-left: 30%;">
- <h4 class="title">Login Security</h4>
- <form class="form-area " id="myForm" action="mail.php" method="post" class="contact-form text-right">
- <div class="row">
- <div class="col-lg-8 form-group">
- <label>Two-Step Verification</label>
- <div class="single-widget">
- <i class="fa fa-phone-square"></i>
- </div>
- <label>Last Name</label>
- <label>Email</label>
- <label>Username</label>
- <label>Password</label>
- <button onclick="window.location.href = 'profile-edit.php';" class="primary-btn mt-20 text-white" style="float: right;">Save</button>
- <div class="mt-20 alert-msg" style="text-align: left;"></div>
- </div>
- </div>
- </form>
- </div>
- <script>
- function openTab(evt, cityName) {
- var i, tabcontent, tablinks;
- tabcontent = document.getElementsByClassName("tabcontent");
- for (i = 0; i < tabcontent.length; i++) {
- tabcontent[i].style.display = "none";
- }
- tablinks = document.getElementsByClassName("tablinks");
- for (i = 0; i < tablinks.length; i++) {
- tablinks[i].className = tablinks[i].className.replace(" active", "");
- }
- document.getElementById(cityName).style.display = "block";
- evt.currentTarget.className += " active";
- }
- // Get the element with id="defaultOpen" and click on it
- document.getElementById("defaultOpen").click();
-
- // Animate the div tabcontent
- $(document).ready(function(){
- $('.tablinks').click(function(){
- $('.tabcontent').addClass('animated slideInRight');
- });
- });
-
- </script>