How do I un check a radio button within the input box. I've been trying to uncheck this radio button with javascript but I can't seem to be able to do it when its inside an array
this is the code that I want to un check with javascript
<?php
for($i = 0; $i < 3; $i ++){
$num = rand(0,2);
for($j = 0; $j < 3; $j++){
if($num){
$check = 'checked';
}else
$check='';
echo '<input name="acc['.$i.']" type="radio" '.$check.'>';
}
echo '<br/>';
}
?>
I've tried with this javascript but I don't know how to point to the actual radio button to uncheck
$(':radio').mousedown(function(e){
var $self = $(this);
if( $self.is(':checked') ){
var uncheck = function(){
setTimeout(function(){
$self.removeAttr('checked');
},0);
};
var unbind = function(){
$self.unbind('mouseup',up);
};
var up = function(){
uncheck();
unbind();
};
$self.bind('mouseup',up);
$self.one('mouseout', unbind);
}
});