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

227
Views
I have a carousel that I am trying to access each object individually and eventually add a checked property to a radio input

So I am making a carousel and I want the user to be able to swipe and see the next image. I am currently using radio inputs and want to change the property to checked once the user has swiped the container. I don't know how to access one element in my object to then add a property of checked to it. Any help would be appreciated! Thanks in advance!

let touchstartX = 0
let touchendX = 0
let radio = document.getElementsByClassName('radio')
console.log(radio)

function checkDirection() {
  if (touchendX < touchstartX) {
    alert('swiped left')
  }
  if (touchendX > touchstartX) alert('swiped right!')
}

document.addEventListener('touchstart', e => {
  touchstartX = e.changedTouches[0].screenX
})

document.addEventListener('touchend', e => {
  touchendX = e.changedTouches[0].screenX
  for (let i = 0; i < radio.length; i++) {
    if (touchendX < touchstartX) {
      console.log(radio[i])
      checkDirection()
    }
  }
});
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!