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

  • Home
  • SEARCH
  • 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 7844699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:58:11+00:00 2026-06-02T16:58:11+00:00

I have two checkboxes in my code as mentioned below: <input type=checkbox id=event_id name=data[Noncompetitor][event_id][]

  • 0

I have two checkboxes in my code as mentioned below:

<input type="checkbox" id="event_id" name="data[Noncompetitor][event_id][]" value="1">
<input type="checkbox" id="event_id" name="data[Noncompetitor][event_id][]" value="2">

Now I am doing Ajax function like onCreate and onComplete, where I want to disable checkboxes when its initiated and want to enable again as completed request. I am not sure how that can be achieved in Prototype JS and both above checkboxes have same id.

onCreate: function(){

            document.getElementById("event_id").setAttribute("disabled", "disabled");               
            Element.show('loading_message');
        }, 

onComplete: function(){

            document.getElementById("event_id").removeAttribute("disabled");                                
            Element.hide('loading_message');
        },

My Above code works, but it disables only first checkbox, so please help me here.

Thanks !

  • 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-02T16:58:14+00:00Added an answer on June 2, 2026 at 4:58 pm

    You can’t have two ids of the same in a HTML page, nothing is stopping you from putting two ids of the same in a HTML page you can but you kill a kitten everytime you do that, and furthermore having two ids will confuse yourself in cases like this. document.getElementById would return the first id it finds and stop caring about the other everytime you have two ids of the same in a HTML page, thus why it only works for one checkbox.

    You can either assign classes to your checkboxes, or you can reference your checkbox using name attribute if your form is also named.

    http://jsfiddle.net/Q5qNg/7/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see coments in js code. I have two checkboxes <input type=checkbox name=first id=first
I have the following code: <ul id=litemsd> <li class=litemd> <input type=checkbox id=d1 name=d1 />
I have written code for two checkboxes: string sdate= Convert.ToDateTime(txtFromDate.Value); string edate=Convert.ToDateTime(txtEndDate.Value); I am
I have the following two code blocks. Code block 1 var checkboxes = $(div.c1
I am looping through a bunch of array type fields. I have two checkboxes
I have the code below which loops through selected checkboxes and executes and sql
I have two columns of checkboxes with a select all checkbox at the bottom
I have two checkboxes (Recommended and Others) which have peoples names (concatenated, i.e. John
I have two CheckBoxes and a TextBox. I want to TextBox to have IsEnabled=False
Following on from a previous question . Lets say I have two checkboxes on

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.