能幫我看看么 我這樣子寫可以么
?<input type="email" id="email" placeholder="Enter email">
<br></br>
?你對(duì)什么運(yùn)動(dòng)感興趣
? <br><label>慢跑</label><input type="checkbox">
??
? <br><label>登山</label><input type="checkbox">
? ?
? <br><label>藍(lán)球</label><input type="checkbox">
??
2016-06-17
可以這么寫,但是不規(guī)范,在實(shí)際開發(fā)中 label標(biāo)簽里要寫for屬性,用來說明綁定的元素的 id. ?而input標(biāo)簽 要寫value值,用來跟后臺(tái)做交互, 而br標(biāo)簽也不規(guī)范. ?總體來說 ?代碼可以實(shí)現(xiàn)效果,但是實(shí)際開發(fā)中這么寫完全錯(cuò)誤
2016-06-17
為了讓用戶有更好的體驗(yàn),在鼠標(biāo)點(diǎn)擊整個(gè)label標(biāo)簽后,就能關(guān)聯(lián)勾選中對(duì)應(yīng)的checkbox。對(duì)此我們可以在<label>內(nèi)加入for屬性,且屬性值必須與<checkbox>的id值一致。如:
<label for="mp">慢跑</label><input type="checkbox" id="mp"><br />
<label for="ds">登山</label><input type="checkbox" id="ds"><br />
<label for="lq">籃球</label><input type="checkbox" id="lq"><br />
2016-06-17
可以,但是最好給checkbox 加不一樣name
2016-06-17
不正確。你這樣鼠標(biāo)點(diǎn)擊慢跑兩個(gè)字沒有用。首先<input type="checkbox">這里需要一個(gè)id="",比如running,然后label后面應(yīng)該有 for屬性,表示和哪個(gè)表單綁定,比如第一行應(yīng)該是<label for="running">慢跑</label><input type="checkbox" name="sport" id="running"/>
2016-06-17
可以得
2016-06-17
可以。
2016-06-17
可以的