[英]Checkbox is not displaying as checked, even though it is
我有一個PHP腳本,它根據數據庫記錄將checked="checked"
為復選框。 但是,除了第一次出現的所有復選框,都顯示為已選中。 這是HTML瀏覽器對其進行解析時的外觀:
<input type="checkbox" id="not_online"><label for="not_online">Not Online</label>
<input type="checkbox" id="facebook" checked="checked"><label for="facebook">Facebook</label>
<input type="checkbox" id="twitter" checked="checked"><label for="twitter">Twitter</label>
這就是我在FF26.0中看到的
[ ] Not Online
[ ] Facebook
[×] Twitter
是什么原因引起的?
為每個復選框字段添加name
:
<input type="checkbox" id="not_online" name="not_online"><label for="not_online">Not Online</label>
<input type="checkbox" id="facebook" name="facebook" checked="checked"><label for="facebook">Facebook</label>
<input type="checkbox" id="twitter" name="twitter" checked="checked"><label for="twitter">Twitter</label>
它對我來說很好,您有什么問題? 這是我的小提琴http://jsfiddle.net/dbDj3/
使用您的代碼
<input type="checkbox" id="not_online"><label for="not_online">Not Online</label>
<input type="checkbox" id="facebook" checked="checked"><label for="facebook">Facebook</label>
<input type="checkbox" id="twitter" checked="checked"><label for="twitter">Twitter</label>
一定是導致問題的代碼的其他部分
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.