Kheta Ram Sansi
Kheta Ram Sansi

Reputation: 261

jQuery 1.9 checkbox not checked second time after once it unchecked

In jQuery 1.9 v checkbox is not checked, once I have unchecked it, trying to check again by clicking on button

$("#add_cart_checkbox").attr("checked",'checked') ;

Upvotes: 25

Views: 12083

Answers (2)

Zaheer Ahmed
Zaheer Ahmed

Reputation: 28528

working fine On This JsFiddle

$("#add_cart_checkbox").attr("checked",'checked') ;

It must be a problem of event bubbling which causes to call click event twice.

Upvotes: 1

Joseph Silber
Joseph Silber

Reputation: 219920

You have to use prop, and pass it a boolean:

$("#add_cart_checkbox").prop("checked", true) ;

Upvotes: 57

Related Questions