Skip to main content

Bug Tracker

Side navigation

#13713 closed bug (notabug)

Opened April 02, 2013 04:52PM UTC

Closed April 02, 2013 10:27PM UTC

Last modified April 03, 2013 02:33PM UTC

Click event can be only generated once.

Reported by: kevin_tom@hotmail.com Owned by: kevin_tom@hotmail.com
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.

Attachments (0)
Change History (7)

Changed April 02, 2013 04:56PM UTC by rwaldron comment:1

owner: → kevin_tom@hotmail.com
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/

Changed April 02, 2013 06:01PM UTC by kevin_tom@hotmail.com comment:2

status: pendingnew

Replying to [comment:1 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: - jQuery 1.9.x http://jsfiddle.net/FrKyN/ - jQuery 2.0.x http://jsfiddle.net/VUp3e/ 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/

Changed April 02, 2013 10:24PM UTC by m_gol comment:3

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.

Changed April 02, 2013 10:27PM UTC by rwaldron comment:4

resolution: → notabug
status: pendingclosed

Changed April 03, 2013 02:22PM UTC by anonymous comment:5

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.

Changed April 03, 2013 02:25PM UTC by kevin_tom@hotmail.com comment:6

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

Changed April 03, 2013 02:33PM UTC by dmethvin comment:7

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.