Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

105
Vistas
Problem on checking local.storage item on load

I'm actually trying to make something like a pokedex for forza horizon 5, you checked the box when you unlock everything on the car. But i have a problem when i need to use the local storage who are there. I can see them "true" in the inspector but i try a lot of thing but nothing work.

If someone has a solution for me

Thanks

My php doc to create the 500 div of cars

<?php 
include('data.php'); 
$data = getCars();
$pagetitle = 'Equipe est OK';
include('javascript.js'); 
?>

    <html>
        <?php include('head.php'); ?>
        <body>
              <!--  <?php foreach($data as $value){ ?>
                    <li><?php echo $value["1"] . ' (' . $value["text"] . ')'; ?></li>
                <?php } ?> -->
            <section class="content">
                
                <div class="content__dispo">
                    <?php foreach($data as $value){ ?>
                        <div class="block_car">
                            <span><?php echo $value["text"] ?></span>
                            <input class="input" type="checkbox">
                        </div>
                    <?php } ?> -->
                </div>
    
            </section>
        </body>
    </html>

and my javascript to select them and to put on them an addeventlistener for my localstorage :

var input = document.getElementsByClassName('input');
let con = 0;
for (let i = 0; i < input.length; i++) {

    input[i].addEventListener("click", (e) => {
        if(input[i] == true){
            localStorage.setItem("input"+[i], input[i].unchecked);
        } else {
            localStorage.setItem("input"+[i], input[i].checked);
        }
    });

}

console.log(input);
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda