Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

103
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!