8
Ich habe mehrere Formulare auf einer Seite. Jedes Formular hat genau den gleichen Inhalt. Aber ich stieß auf ein Problem mit meinen Labels. Ich weiß, dass Label "for" -Tag eindeutig sein sollte und wies auf die Element-ID, aber ich muss das Formular aus irgendeinem Grund multiplizieren. Bitte beachten Sie meinen Code in jsfiddle gefunden my codeMehrere gleiche Formularbezeichnung in einer Seitenausgabe
<form>
<label for="option1">Option 1</label>
<input type="radio" id="option1" name="options">
<label for="option2">Option 2</label>
<input type="radio" id="option2" name="options">
<label for="option3">Option 3</label>
<input type="radio" id="option3" name="options">
</form>
<!-- another form but the same content -->
<form>
<label for="option1">Option 1</label>
<input type="radio" id="option1" name="options">
<label for="option2">Option 2</label>
<input type="radio" id="option2" name="options">
<label for="option3">Option 3</label>
<input type="radio" id="option3" name="options">
</form>
Dank
'for' muss nicht eindeutig sein. "id" tut es. Sie können mehrere Beschriftungen verwenden, die auf dasselbe Formularsteuerelement zeigen. – Quentin