abu abu
abu abu

Reputation: 7028

Stray end tag "form"

I am getting error Stray end tag "form" in below HTML code.

<section class="login-section reg-section card">
  <div class="container">
    <div class="row mt-5 ">
      <div class="col-md-6">
        <div class="reg-left">
          <h3>Account Login Details</h3>
          <form method="POST" action="">

            <div class="form-group">
              <label for="email">Email Address*</label>
              <input value="" type="email" name="reg_email" class="form-control " placeholder="Email" id="login_email" required>
            </div>
            <div class="form-group">
              <label for="password">Password*</label>
              <input type="password" name="password" class="form-control " placeholder="Password" required>
            </div>
            <div class="form-group">
              <label for="password_confirmation">Confirm Password*</label>
              <input type="password" name="password_confirmation" class="form-control " placeholder="Confirm Password" required>
            </div>
        </div>


        <button type="submit" class="btn">Submit</button>
        </form>
</section>

enter image description here

Why I am getting this error ? Why the tags are red ? How can I fix it ?

Upvotes: 0

Views: 1131

Answers (3)

GJvKl
GJvKl

Reputation: 25

You close the div that contains the form and try to close the form afterward.

try closing the div after you close the form.

the correct way of how your form should look like:

<form method="POST" action="">
  <div class="form-group">
    <label for="email">Email Address*</label>
    <input value="" type="email" name="reg_email" class="form-control " placeholder="Email" id="login_email" required>
  </div>
  <div class="form-group">
    <label for="password">Password*</label>
    <input type="password" name="password" class="form-control " placeholder="Password" required>
  </div>
  <div class="form-group">
      <label for="password_confirmation">Confirm Password*</label>
      <input type="password" name="password_confirmation" class="form-control " placeholder="Confirm Password" required>
  </div>
  <button type="submit" class="btn">Submit</button>
</form>

Upvotes: 1

racraman
racraman

Reputation: 5034

Firstly, look at your indentation - you have :

    <form>
        <div>
        </div>
        <div>
        </div>
        <div>
        </div>
</div>
</form>

So your core problem is that that red-coloured end-div tag does not match an opening div tag, so the solution is to just delete it.

In addition, you are not closing your input tags; have them finish with />.

Upvotes: 1

Cameron Little
Cameron Little

Reputation: 3711

You have an extra closing div tag at line 123, as highlighted by your editor in your screenshot.

The red in the screenshots are indicating issues with your html structure. The form and div tags need to have associated closing tags that allow them to wrap their contents. As is, you are closing a div that doesn't have an associated "opening" tag within its direct parent.

Delete the extra closing div tag to fix the current errors, then you'll probably need to close the remaining div tags within your section.

Upvotes: 2

Related Questions