Reputation: 433
I am using the following code:
$('#send_order_form input[type="radio":checked]').each(function(){
this.checked = false;
});
But I still see the radio button clicked. On inspecting element, checked attribute is actually removed. Wierd, I am using chrome.
Upvotes: 0
Views: 131
Reputation: 433
I was using form within a form. That's why the problem was occurring. Now after removing the child form, the problem is solved.
Upvotes: 0
Reputation: 2893
You have a slight error in your selector for checked inputs. Try this:
$('#send_order_form input[type="radio"]:checked').each(function(){
this.checked = false;
});
Or even better
$('#send_order_form input[type="radio"]:checked').attr('checked', false);
Upvotes: 0
Reputation: 6993
Try this:
$('#send_order_form input[type="radio":checked]').each(function(){
$(this).prop('checked', false);
});
Upvotes: 0
Reputation: 583
Try to remove the checked attribute using jquery removeAttr instead:
$('#send_order_form input[type="radio":checked]').each(function(){ $(this).removeAttr("checked"); });
Upvotes: 1