Ich versuche eine Checkliste zu erstellen, aber nur das erste Kontrollkästchen funktioniert. Wenn ich auf die anderen klicke, wird das erste Kästchen aktiviert. Außerdem habe ich "text-decoration: line-through" hinzugefügt. aber es wird nicht im Text angezeigt. Ich bin mir ziemlich sicher, dass ich das mit HTML beheben kann.Checkboxen funktionieren nicht
http://codepen.io/tyl-er/pen/kXmkqB?editors=0100
Hier ist mein Code:
<div class="box">
<input type='checkbox' name='thing' value='valuable' id="thing"/><label for="thing"></label> get an army
<br>
<input type='checkbox' name='thing' value='valuable' id="thing"/><label for="thing"></label> free the slaves
<br>
<input type='checkbox' name='thing' value='valuable' id="thing"/><label for="thing"></label> train my dragons
<br>
<input type='checkbox' name='thing' value='valuable' id="thing"/><label for="thing"></label> cross the narrow sea
<br>
<input type='checkbox' name='thing' value='valuable' id="thing"/><label for="thing"></label> become Queen of Westeros
</div>
<style>
input[type=checkbox] {
display:none;
}
input[type=checkbox] + label
{
background: #999;
height: 16px;
width: 16px;
display:inline-block;
padding: 0 0 0 0px;
}
input[type=checkbox]:checked + label
{
background: #0080FF;
text-decoration: line-through;
height: 16px;
width: 16px;
display:inline-block;
padding: 0 0 0 0px;
}
</style>
Danke, das hat es total repariert. –