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

127
Views
how I can link checkbox with button to open page in JavaScript?

how I can link checkbox with button to open page in JavaScript? I Need When Iam Click To Button All Links open here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Here's an example.

  1. Create the HTML

  2. In JavaScript, get references to the inputs and the button

  3. Add an event listener on the button. When clicked, perform whatever logic you need to by accessing input.checked to determine if it was checked, and input.value to determine it's value (which is the string associated with the value attribute in the input's HTML)

const inputs = document.querySelectorAll("input")
const button = document.querySelector("button")

button.addEventListener("click", event => {
  alert(
    `The following buttons were checked: ${Array.from(inputs).filter(input => input.checked).map(input => input.value).join(", ")}`
  )
})
button {
  display: block;
  margin: 15px 0;
}
<p>Select your favorite colors:</p>

<label><input type="checkbox" name="color" value="red" /> Red</label>
<label><input type="checkbox" name="color" value="green" /> Green</label>
<label><input type="checkbox" name="color" value="blue" /> Blue</label>

<button>Get Selected Colors</button>

about 4 years ago · Juan Pablo Isaza Report
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!