John Livermore
John Livermore

Reputation: 31313

embedded HTML form is discarded

It seems Chrome ignores forms that are embedded inside another form.

See this fiddle (http://jsfiddle.net/jeljeljel/NbUeQ/1/)

HTML

<form>
    <div id="dialog">
        <form id="theForm">
            <label>abc</label>
        </form>
    </div>
</form>

JS

alert($('#theForm').length);

Note 'theForm' is not found.

Is the only solution to not have embedded forms?

Upvotes: 4

Views: 53

Answers (1)

Jacques Snyman
Jacques Snyman

Reputation: 4290

Yes.

The only solutions is not to embedded forms as this is not valid HTML.

See the W3C XHTML spec's Element Prohibitions section at http://www.w3.org/TR/xhtml1/#prohibitions

Upvotes: 3

Related Questions