Editor giving "Unexpected End Tag" syntax error for HTML file

Tarkenfire picture Tarkenfire · Oct 25, 2012 · Viewed 18.2k times · Source

Edit: Because of the time restriction of the project I just had to revert to a working copy of the code and redo all my work, but I would still like to know what the reason is for this for the future.

So, I've had this problem now for a little while, of one of the dags in this HTML file I've been working on where a from and div tags would get underlined by my editor (Komodo) saying something to the effect of "Unexpected End Tag (ignored). This wasn't causing much problems so I just ignored it...until the editor started highlighting the closing body tag with the same thing and the file doesn't actually work correctly (using JQM) anymore.

The thing I don't understand is that I haven't been touching the HTML AT ALL. In the past when this happened (as it has before), I just pulled a previous version from the repo I'm using and that would resolve the issue, but this time I haven't made a commit in a while and I really want to find a solution to this problem rather than a quick fix.

Here is a screenshot of the syntax error I'm getting via my editor:

enter image description here

Here is the HTML for the form, if it matters:

        <div data-role="content">
                        <img src="img/logo.png" alt="RPG Tracker">
        <form action="" method="post" id="addCharForm">
            <fieldset data-role="controlgroup">
                <label for="dateCreated">Date Created:</label>
            <input type="date" name="dateCreated" id="dateCreated">
        </fieldset>

        <fieldset data-role="controlgroup">
                <label for="charAge">Age:</label>
            <input type="text" name="charAge" id="charAge" value="" class="required number">
        </fieldset>

        <fieldset data-role="controlgroup">
            <label for="charName">Name:</label>
            <input type="text" name="charName" id="charName" value="" class="required">
        </fieldset>

        <fieldset data-role="controlgroup" data-type="horizontal">
            <legend>Choose character gender:</legend>
            <input type="radio" name="gender" id="radioMale" value="Male">
            <label for="radioMale">Male</label>

            <input type="radio" name="gender" id="radioFemale" value="Female">
            <label for="radioFemale">Female</label>
        </fieldset>

        <fieldset data-role="controlgroup">
            <label for="charAttrs">Describe your character's <b>attributes</b> in this field:</label>
            <textarea id="charAttrs" name="charAtts"></textarea>
        </fieldset>
        <fieldset data-role="controlgroup">
            <label for="charSkills">Describe your character's <b>skills</b> in this field:</label>
            <textarea id="charSkills" name="charSkills"></textarea>
        </fieldset>
        <fieldset data-role="controlgroup">
            <label for="charBio">Character Biography:</label>
            <textarea id="charBio" name="charBio"></textarea>
        </fieldset>
        <fieldset data-role="controlgroup">
            <label for="charRating">Rate Your Character:</label>
            <input type="range" name="charRating" id="charRating" value="100" min="0" max="100">
        </fieldset>

        <input type="reset" value="Reset">
        <input type="submit" value="Submit Character" data-theme="b">
        </form>
    </div>

As requested, here's the full html: http://pastebin.com/tsE0MuP7

Answer

Ian Devlin picture Ian Devlin · Oct 25, 2012

The input and img tags are self closing, so I suggest closing them all and seeing if that fixes it. (I suspect it won't, but it's worth a try).

e.g.

<img src="img/logo.png" alt="RPG Tracker" />

and

<input type="date" name="dateCreated" id="dateCreated" />

The issue could be elsewhere in the file too, so a copy of the entire HTML would be preferable. It will probably be an open tag somewhere (e.g. using <div> instead of </div>).