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 6321995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:15:02+00:00 2026-05-24T16:15:02+00:00

modified question after answer to use onclick=$( ‘#co1’ ).attr( ‘checked’, true ); this works

  • 0

modified question after answer to use onclick=”$( ‘#co1’ ).attr( ‘checked’, true );” this works great with the disabled=”disabled” attribute…..

but…The $aBoxes.change(function(){ does not seem to work with onclick=”$( ‘#co1’ ).attr( ‘checked’, true );”

Original question…..

I was told that “When element is disabled, events are also disabled.”

I would like to disable a checkbox, but have an event triggered by clicking a link.

I have this jquery:

var $aBoxes = $('#co1,#co2,#co3');
$aBoxes.change(function(){
  // check if all are checked based on if the number of checkboxes total
  // is equal to the number of checkboxes checked
  if ($aBoxes.length == $aBoxes.filter(':checked').length){
      $('#a1').hide();
      $('#a2').show();
  }else{
    $('#a1').show();
    $('#a2').hide();
  }
});


<div id="a1">
a1 div
</div>

<div id="a2" style="display:none;">
a2 div
</div>

<div class="content">
<ul>
<li>
<input disabled="disabled" id="co1" name="co1" type="checkbox" <?php if($mychecklist->co1==1) echo 'checked' ?>/>
<a href="http://bbc.co.uk" target="_blank" onclick="$( '#co1' ).attr( 'checked', true );">Link 1</a>
</li>
<li>
<input disabled="disabled" id="co2" name="co2" type="checkbox" <?php if($mychecklist->co2==1) echo 'checked' ?>/>
<a href="http://bbc.co.uk" target="_blank" onClick="$( '#co2' ).attr( 'checked', true );">Link 2</a>
</li>
<li>
<input disabled="disabled" id="co3" name="co3" type="checkbox" <?php if($mychecklist->co3==1) echo 'checked' ?>/>
<a href="http://bbc.co.uk" onClick="$( '#co3' ).attr( 'checked', true );">Link 3</a>
</li>
</ul>
</div>

The onclick event on the link works great for checking the checkbox, but i would like to disable using disabled=”diasabled” the checkbox and still have it working. This is so the user has to click on the link for the checkbox to be checked, rather than bypassing this step and checking the checkbox themselves.

Thanks in advance for any help.

  • 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-05-24T16:15:03+00:00Added an answer on May 24, 2026 at 4:15 pm

    It’s not clear whether you want to check the disabled checkbox using an <a> link or trigger a click event attached to the checkbox. If the former, you can use $( '#tt2' ).attr('checked', !$( '#tt2' ).attr('checked') ) to toggle the checkbox or $( '#tt2' ).attr( 'checked', true ) to check it. If the latter, the click event should still run even if the checkbox is disabled.


    If you need to both check the box and trigger an event just use both techniques.

    <a href="http://bbc.co.uk" target="_blank" 
        onclick="$( '#co1' ).attr( 'checked', true ).trigger( 'change' );">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have modified the title of the question after finding the answer :) :P
I found this in another question/answer and modified it... but it still doesn't work.
This is a question regarding the timezone specified in the Expires and Last-Modified HTTP
After asking a question about sending 304 Not Modified for images stored in the
After reading this question I attempted to clean out my workspace and found that
I started with this question: Multiple Javascript gadgets per page . After reading up
I try to use jqplot for drawing an graph. So i modified this example
Note: This is question to which I have already found an answer. It seems
Related to my other question , I have now modified the sparse matrix solver
EDIT: Modified title and added update. UPDATE : We no longer believe this is

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.