1級標題代表標簽
2級標題代表屬性
The form element that the input element is associated with (its form owner). The value of the attribute must be an id of a element in the same document. If this attribute is not specified, this element must be a descendant of a element. This attribute enables you to place elements anywhere within a document, not just as descendants of their form elements.
一般input標簽都是放在form標簽里面去提交的,但現在,允許將input標簽放在任何地方,只要給input設置form屬性,值為form標簽的id值。
例如這樣:
<form id="form" action="/">
<button>submit</button>
</form>
<input form="form" type="hidden" name="id" value="001">
這樣點擊submit按鈕后,就會自動帶上 id=001 這個參數了
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系我们删除。