Reputation: 1523
This makes a textarea go blank in my application:
$('#questionTextArea').val('');
What I want to know is how can I make radio buttons go back to all being unselected? the class of each radio button is .replyBtn
Upvotes: 1
Views: 2745
Reputation: 851
For jQuery version 1.6 and above, you should use:
$(".replyBtn").prop('checked', false);
Before jQuery version 1.6, you could use:
$(".replyBtn").attr("checked", false);
But it is best to use the .prop
method, as in version 1.6, they are trying to keep .attr
only for attributes and .prop
for properties.
Upvotes: 2
Reputation: 126052
Check out .prop
:
$(".replyBtn").prop("checked", false);
Example: http://jsfiddle.net/WdUpn/
Upvotes: 4
Reputation: 754783
Try the following
$('.replyBtn').each(function () { $(this).attr('checked', false); });
Fiddle: http://jsfiddle.net/cM8Lq/1/
Upvotes: 2