Home > other >  When ever i am clicking login button my html page is open again on other tab how can i fix this issu
When ever i am clicking login button my html page is open again on other tab how can i fix this issu

Time:10-15

When ever I am clicking login button my html page is open again on other tab how can I fix this issue? I have made a html form so when ever I click on login than html page is opening in new tab how to fix this problem

my html code

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Contact Us</title>
    <link rel="stylesheet" href="style.css">
    <script src="script2.js"></script>

    <script
      type="text/javascript"
      src="https://cdn.jsdelivr.net/npm/@emailjs/browser@3/dist/email.min.js"
    ></script>
    </script>
  </head>
  <body>
    <div id="wrapper">
      <div >
        <div ></div>
        <div >
          <form id="myForm" action="" target="_blank">
            <div >
              <img src="./images/logo.png" alt="logo">
            </div>
            <input type="text" placeholder="Phone number, username, or email"   id="email">
            <input type="password" placeholder="Password"   id="name">
            <button   onclick="sendMail()">Log in</button>
            <span >Or</span>
            <a  href="#">
              <i ></i> Log in with Facebook
            </a>
            <a  href="#">Forgot password?</a>
          </form>
          <div >
            Don't have an account? <a href="#">Sign up</a>
          </div>
          <div >
            <span>Get the app.</span>
            <div >
              <img src="./images/app-store.png" alt="app-store badge">
              <img src="./images/google-play.png" alt="google-play badge">
            </div>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>

CodePudding user response:

Remove the target="_blank" attribute from your form tag to avoid opening in another tab.

  • Related