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

173
Views
How do I check and uncheck for list of checkboxes coming from JSON data in LWC

Hi there I'm working on a functionality for checkbox selection limited for 4 checkbox in the list , so now I have filter hue-rotate in styling for 4 selected checkbox , now if I uncheck the anyone of selected and check different selection I should be able to view the left out color to be added over there.

 handleChange(){
    let checkboxes = this.template.querySelectorAll('.vehicleCheck');
    checkboxes.forEach((checkbox) => {
        checkbox.addEventListener('click', (e) => { 
            let checked = this.template.querySelectorAll('.vehicleCheck:checked');
           if( checked[1].length==1 ){
                checked.style.cssText=" filter: hue-rotate(0deg)";
            }else if (checked[2].length==1){  
                checked.style.cssText="filter: hue-rotate(50deg);";
            }else if (checked[3].length==1) {
                checked.style.cssText="filter: hue-rotate(89deg);";
            }else if (checked[4].length==1){
                checked.style.cssText="filter: hue-rotate(180deg) brightness(1.5);";
            }else if(checked.length >= 5){
                e.preventDefault();
                e.stopPropagation();
            }
        });
    });
}





<div class="trend-vehicles-container">
            <div class="trend-vehicles">
              <template for:each={summerizedArray} for:item="Fer">
                <div class="trend-each-vehicle" key={Fer.chassisIds}>
                  <input type="checkbox" value={Fer.chassisIds} id={Fer.chassisIds} onchange={handleChange} data-id="overview" class="vehicleCheck" /> 
                  <span style="font-size: 13px;">{Fer.chassisIds}</span>
                </div>
              </template>
            </div>
          </div>

Actual output

Expected

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!