Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9194305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:22:50+00:00 2026-06-17T21:22:50+00:00

Recently I have been working with the Chrome Plugin API and I am looking

  • 0

Recently I have been working with the Chrome Plugin API and I am looking to develop a plugin which will make life easier for me for managing a website.

Now what I wish to do is to fire an event when a certain checkbox is checked.
As this website does not belong to me I cannot change the code therefore I am using the Chrome API. One of the main problems is that rather than there being an ID, there is a Name. I was wondering if I could fire the function once the certain checkbox with the ‘name’ is checked.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:22:51+00:00Added an answer on June 17, 2026 at 9:22 pm

    Short answer: Use the change event. Here’s a couple of practical examples. Since I misread the question, I’ll include jQuery examples along with plain JavaScript. You’re not gaining much, if anything, by using jQuery though.

    Single checkbox

    Using querySelector.

    var checkbox = document.querySelector("input[name=checkbox]");
    
    checkbox.addEventListener('change', function() {
      if (this.checked) {
        console.log("Checkbox is checked..");
      } else {
        console.log("Checkbox is not checked..");
      }
    });
    <input type="checkbox" name="checkbox" />

    Single checkbox with jQuery

    $('input[name=checkbox]').change(function() {
      if ($(this).is(':checked')) {
        console.log("Checkbox is checked..")
      } else {
        console.log("Checkbox is not checked..")
      }
    });
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    
    <input type="checkbox" name="checkbox" />

    Multiple checkboxes

    Here’s an example of a list of checkboxes. To select multiple elements we use querySelectorAll instead of querySelector. Then use Array.filter and Array.map to extract checked values.

    // Select all checkboxes with the name 'settings' using querySelectorAll.
    var checkboxes = document.querySelectorAll("input[type=checkbox][name=settings]");
    let enabledSettings = []
    
    /*
    For IE11 support, replace arrow functions with normal functions and
    use a polyfill for Array.forEach:
    https://vanillajstoolkit.com/polyfills/arrayforeach/
    */
    
    // Use Array.forEach to add an event listener to each checkbox.
    checkboxes.forEach(function(checkbox) {
      checkbox.addEventListener('change', function() {
        enabledSettings = 
          Array.from(checkboxes) // Convert checkboxes to an array to use filter and map.
          .filter(i => i.checked) // Use Array.filter to remove unchecked checkboxes.
          .map(i => i.value) // Use Array.map to extract only the checkbox values from the array of objects.
          
        console.log(enabledSettings)
      })
    });
    <label>
       <input type="checkbox" name="settings" value="forcefield">
       Enable forcefield
    </label>
    <label>
      <input type="checkbox" name="settings" value="invisibilitycloak">
      Enable invisibility cloak
    </label>
    <label>
      <input type="checkbox" name="settings" value="warpspeed">
      Enable warp speed
    </label>

    Multiple checkboxes with jQuery

    let checkboxes = $("input[type=checkbox][name=settings]")
    let enabledSettings = [];
    
    // Attach a change event handler to the checkboxes.
    checkboxes.change(function() {
      enabledSettings = checkboxes
        .filter(":checked") // Filter out unchecked boxes.
        .map(function() { // Extract values using jQuery map.
          return this.value;
        }) 
        .get() // Get array.
        
      console.log(enabledSettings);
    });
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <label>
       <input type="checkbox" name="settings" value="forcefield">
       Enable forcefield
    </label>
    <label>
      <input type="checkbox" name="settings" value="invisibilitycloak">
      Enable invisibility cloak
    </label>
    <label>
      <input type="checkbox" name="settings" value="warpspeed">
      Enable warp speed
    </label>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working with a small project recently which involves Struts 2 and
I have recently been working with the highchart api to plot some data on
I have recently been working on a nodejs app which uses open socket connections
I have recently been working on implementing an ajax based file uploader for my
I have recently been working on a Pastebin script (for fun) and I've come
I have recently been working to better my understanding of sorting algorithms and their
I have been working on Eclipse recently. I am fairly new to java programming,
I have been working with databases recently and before that I was developing standalone
I have been working on a Java game and I recently wanted to see
Recently I've been working on some embedded devices, where we have some structs and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.