javascript - on submit redirect to same tab of the same page -


i have page 4 different tabs.

the first tab loaded default , when click on tab opens particular tab.

now, in 1 tab resetting password , on button submit want load same tab again. default tab loaded.

i have tried many javascript codes can´t desired result. please me issue.

below code using on page.

<?php    include('../logic.php'); ?>  <?php  $username=$_session['username']; echo $username; include 'inc/header.inc.php'; include '../connect.php'; ?> <?php  $username=$_session['username']; if(isset($_post['submit']) && isset($_post['password'])){   $password = $_post['password'];   $confirmpassword = $_post['confirmpassword'];   include '../connect.php';  if ($password == $confirmpassword && $password!=' ' && $confirmpassword!=' ') { $sql = "update partner set password='$password' username='".$_session['username']."'"; if(mysqli_query($connection, $sql)){     $password_error="password updated successfully"; }  else {     $password_error= "error: not able execute $sql. " . mysqli_error($connection);  }   } else{   $password_error = "password not match or field empty";    }  } else{  }  ?> <div class="tab">   <button name="tabdiv" class="tablinks" onclick="opencity(event, 'profile')">profile</button>   <button name="tabdiv1" class="tablinks" onclick="opencity(event, 'pass')" >change password</button>   <button name="tabdiv2" class="tablinks" onclick="opencity(event, 'email')">change email id</button>   <button name="tabdiv3" class="tablinks" onclick="opencity(event, 'number')">change number</button> </div> <div id="pass" name="pass" class="tabcontent">   <span onclick="this.parentelement.style.display='none'" class="topright">x</span>  <center> <div id="sc-password">   <h5>reset password</h5>   <div class="sc-container">   <form method="post" action="">      <input type="password" placeholder="password" name="password" style="border: none;     border-bottom: 2px solid #008cba; width: 20%;" /><br><br>     <input type="password" placeholder="confirm password" name="confirmpassword" style="border: none;     border-bottom: 2px solid #008cba; width: 20%;" /><br><br>     <?php if(isset($password_error)){ ?><div role="alert"> <?php echo $password_error; ?> </div><?php } ?>     <br>     <input type="submit" value="submit" name="submit" style="background-color: #008cba; /* green */     border: none;     color: white;     padding: 15px 32px;     text-align: center;     text-decoration: none;     display: inline-block;     font-size: 16px;" onclick="" />     </form>   </div> </div> </center>  </div> <script> function opencity(evt, cityname) {      var i, tabcontent, tablinks;     tabcontent = document.getelementsbyclassname("tabcontent");     (i = 0; < tabcontent.length; i++) {         tabcontent[i].style.display = "none";     }     tablinks = document.getelementsbyclassname("tablinks");     (i = 0; < tablinks.length; i++) {         tablinks[i].classname = tablinks[i].classname.replace(" active", "");     }      document.getelementbyid(cityname).style.display = "block";     evt.currenttarget.classname += " active"; }  // element id="defaultopen" , click on document.getelementbyid("defaultopen").click(); </script> 


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -