Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#13713 closed bug (notabug)

Click event can be only generated once.

Reported by: kevin_tom@… Owned by: kevin_tom@…
Priority: undecided Milestone: None
Component: unfiled Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:

Description

I happened to use jquery-1.9.1.js in my code and found that there is a bug in the library. Here is the pseudo code -- assume you have a few checkboxes. $.each($(my_checkboxes), function(index, obj){

-- I like to un-check the boxes and then check them again -- eventually my code will initialize unchecked boxes and -- check some of them according to my conditions.

$(obj).attr('checked', false); -- checkboxes will never be checked. $(obj).attr('checked', true);

});

The above code will be good if I use jquery-1.6.2.js. You can also produce the bug using event-like code, such as Yahoo Mail bulk deletion. You have a check-all checkbox that triggers all its children's checkboxes. But the event only works at the first time, then stops responding.

Change History (7)

comment:1 Changed 7 years ago by Rick Waldron

Owner: set to kevin_tom@…
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists—you may need to change this to a specific version depending on the test case.

To get you started, use the appropriate boilerplate:

Open the link and click to "Fork" (in the top menu) to begin.

Also, please read: http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/ and http://api.jquery.com/prop/

comment:2 in reply to:  1 Changed 7 years ago by kevin_tom@…

Status: pendingnew

Replying to rwaldron: I just tested using jQuery 1.9.x link as you recommended above. It's not working as I initially described.

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!

Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists—you may need to change this to a specific version depending on the test case.

To get you started, use the appropriate boilerplate:

Open the link and click to "Fork" (in the top menu) to begin.

Also, please read: http://blog.jquery.com/2013/01/15/jquery-1-9-final-jquery-2-0-beta-migrate-final-released/ and http://api.jquery.com/prop/

comment:3 Changed 7 years ago by m_gol

Status: newpending

Please, don't just say it doesn't work but provide a test case. As rwaldron wrote, you have to press the "Fork" button, write the code, make sure the problem exists in the test case, click update and then share the URL here.

comment:4 Changed 7 years ago by Rick Waldron

Resolution: notabug
Status: pendingclosed

comment:5 Changed 7 years ago by anonymous

m_gol, I did everything as you said. The URL is http://jsfiddle.net/XZ5G8/1/. I tried to post the html and js code here but it is all messed up. In my standalone evn, the result will be different if I include jQuery 1.6.x than the jQuery 1.9.x.

comment:6 Changed 7 years ago by kevin_tom@…

The case I am trying to test is that the second time toggling the checkbox will not trigger the event.

comment:7 Changed 7 years ago by dmethvin

That's because you're using .attr() and not .prop() which has been the correct way to do this since jQuery 1.6. The comment by rwaldron has all the information you need to read.

Note: See TracTickets for help on using tickets.