Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Kilka formularzy 'form' z label checkbox i zaznacza się tylko 1szy
Forum PHP.pl > Forum > Po stronie przeglądarki
expert
  1. <label for="cPendrive"><input type="checkbox" name="wyposazenie[]" value="Pendrive" id="cPendrive"/><span>Pendrive</span></label>
  2. </form>
  3. <label for="cPendrive"><input type="checkbox" name="wyposazenie[]" value="Pendrive" id="cPendrive"/><span>Pendrive</span></label>
  4. </form>
  5. <label for="cPendrive"><input type="checkbox" name="wyposazenie[]" value="Pendrive" id="cPendrive"/><span>Pendrive</span></label>
  6. </form>
  7. <label for="cPendrive"><input type="checkbox" name="wyposazenie[]" value="Pendrive" id="cPendrive"/><span>Pendrive</span></label>
  8. </form>
  9. <label for="cPendrive"><input type="checkbox" name="wyposazenie[]" value="Pendrive" id="cPendrive"/><span>Pendrive</span></label>
  10. </form>
  11. <label for="cPendrive"><input type="checkbox" name="wyposazenie[]" value="Pendrive" id="cPendrive"/><span>Pendrive</span></label>
  12. </form>
  13. <label for="cPendrive"><input type="checkbox" name="wyposazenie[]" value="Pendrive" id="cPendrive"/><span>Pendrive</span></label>
  14. </form>


Problem jest taki, że który kol wiek checkbox kliknę, zaznacza się zawsze 1szy. Dla czego to się nie dzieje 'wewnątrz' formularza? Chce uniknąć javascript i nadawania jakiś 'losowych' nazw do for i id
http://jsfiddle.net/4e9tjtL9/
r4xz
Zobacz na 2 pierwszych inputach:
http://jsfiddle.net/4e9tjtL9/1/

...i poczytaj czym jest atrybut "id".
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.