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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:07:58+00:00 2026-06-12T20:07:58+00:00

I come into an interesting issue with the code below: <html> <head> <meta charset=UTF-8/>

  • 0

I come into an interesting issue with the code below:

<html>
<head>
    <meta charset="UTF-8"/>
    <script src="jquery-1.3.2.min.cache.js">
    </script>
    <script>
        $(function(){
        var c = function(){
                  console.log('checked:' + $('#test').attr('checked'));
                };
        $('#test').click(c);
    });
    </script>
</head>

<body>
    <input id="test" type="checkbox" value="1">test
  </input>
</body>
</html>

The issue is when I manually clicked the checkbox, it will print

checked:true
checked:false
checked:true
checked:false 
....

but if I trigger the click event with js code like:

$('#test').click()

it will print like

checked:false
checked:true

Sounds like for manually clicking, the checkbox itself would be rendered as checked/unchecked, then trigger the click event.

But, for JS code of .click(), this is not the case.

Is my guess right? Is there any documentation I can refer to for 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-06-12T20:07:59+00:00Added an answer on June 12, 2026 at 8:07 pm

    The issue is when I manually clicked the checkbox, it will print

    checked:true
    checked:false

    I get:

    > checked:true
    > checked:undefined
    

    The attr method is pretty awful (it used to confuse attributes and properties, probably still does), either read the property directly or use prop. It’s far more efficient to write:

       console.log('checked:' + this.checked);
    

    Anyhow, here’s my former comment:

    Probably because jQuery uses it’s own event registration and firing framework that bypasses the DOM methods. When manually clicking the button, you get the DOM sequence of events. When using jQuery, you get jQuery’s sequence of events.

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

Sidebar

Related Questions

I'm new to CodeIgniter and have come into an issue with the insertion of
I'm trying to convert come vb.net code into C# but came across optional in
I've come across a very strange issue. The following jQuery receives an HTTP 405
I have come across an interesting code example that allows me to make DIV
I've come into an interesting problem (as is often the case in interacting with
I come into ASP.NET from php so the reason why i ask my question
While developing a Launcher (Homescreen) application for Android, I've come into a security exception
I come from a Java background and am getting more into .NET, what are
I tried to get into pyglet and opengl and come up with weird results
I come from a PHP background and I'm just getting my teeth into some

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.