简体   繁体   English

嵌入的HTML表单被丢弃

[英]embedded HTML form is discarded

It seems Chrome ignores forms that are embedded inside another form. Chrome似乎忽略了嵌入在另一个表单中的表单。

See this fiddle ( http://jsfiddle.net/jeljeljel/NbUeQ/1/ ) 看到这个小提琴( http://jsfiddle.net/jeljeljel/NbUeQ/1/

HTML HTML

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

JS JS

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

Note 'theForm' is not found. 注意找不到'theForm'。

Is the only solution to not have embedded forms? 是没有嵌入表单的唯一解决方案吗?

Yes. 是。

The only solutions is not to embedded forms as this is not valid HTML. 唯一的解决方案不是嵌入表单,因为这不是有效的HTML。

See the W3C XHTML spec's Element Prohibitions section at http://www.w3.org/TR/xhtml1/#prohibitions 请参阅http://www.w3.org/TR/xhtml1/#prohibitions上的W3C XHTML规范的元素禁止部分

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM