HTML代碼的Html複選框以進入
<div class="text_site">
<legend><h3>O:</h3></legend>
<ul class = "no-bullets">
<li> <input type="radio" name="radio-button" id="All" value="1"> <label class="radio-label">All</label> </li>
<li> <input type="radio" name="radio-button" id="Just" value="0"> <label class="radio-label">Just</label></li>
<ul class = "no-bullets">
<li>
<input type="checkbox" id="H" name="o[]" value="H">
<label for="H">H</label></li>
<li>
<input type="checkbox" id="R" name="o[]" value="R">
<label for="R">R</label>
</li>
</ul>
</ul>
</div>
<input id="submit" type="submit" value="Submit"/>
<input type="reset" value="Clear the form"/>
CSS代碼
.no-bullets {
list-style:none;
}
但我想創建一個額外的複選框領域,<li> </li>
標籤中,用戶可以寫一些文字,且該文本需要要保存在「o []」我怎麼做到這一點?
我不知道JavaScript我該怎麼做?我可以離開這樣的HTML嗎? – 1pa
@ 1pa一個簡單的方法是簡單地在html中添加一些內聯腳本,如果複選框被選中,就會添加一個文本區域。 Lot的類似例子和演示可以在這裏找到(https://www.w3schools.com/tags/att_onclick.asp)。 – toyo