Bick
Bick

Reputation: 18551

html - in order of elements - not by the order of writnig

In the following fiddler why do I see the "BBBB" before the "AAAA"? I expected the order to be according the <tr>.

<table style="text-align:left;">
  <tr>
    <td class="field">
      <label for="...">...</label> <br/>
      <myattributes>
        <tr>
          <td>
            <li>
              ...<a href="AAAA" data-confirm="Are you sure?" data-method="delete" rel="nofollow">AAAA</a>
            </li>
          </td>
        </tr>
      </myattributes>
      <label>
        <input data-autocomplete-source="..." />
        <a href="/dog">BBBB</a>
      </label>
    </td>
  </tr>
</table>

Upvotes: 1

Views: 54

Answers (1)

Kijewski
Kijewski

Reputation: 26043

Your markup is messed up.

The nested <tr> closes the previous table row and add a new one.

By ending the row with </tr> you are currently not in a table line anymore.

When elements o the markup put between table rows, they are moved above the table in the DOM. That's way you see the "BBBB" first.

Upvotes: 1

Related Questions