jquery settlement selector operative ie7
so i have html so:
<div id="avatar_choices">
<label for="id_choice_0">
<input id="id_choice_0" type="radio" name="choice" value="7" />
<img src="someimage.jpg" />
</label>
<label for="id_choice_1">
<input id="id_choice_1" type="radio" name="choice" value="8" />
<img src="someimage2.jpg" />
</label>
</div>
and script:
$('#avatar_choices input').hide();
$('#avatar_choices img').click(function(){
$('#avatar_choices img').css('border', '2px plain #efefef');
$(this).css('border', '2px plain #39c');
$(this).siblings('input').attr('checked', 'checked');
});
the idea grant user click around settlement options, carrying comparison rhythm border colour.
this works glorious ff. reason ie once i click an image, click another image, following try click initial one, border won't change (though does selected).
edit:
my fortitude finished adult duty half accident. i altered formula due redsquare's answer:
$('#avatar_choices input').hide();
$('#avatar_choices img').click(function(){
$('#avatar_choices img').removeclass('selected');
$(this).addclass('selected');
$(this).siblings('input').attr('checked', 'checked');
});
where:
#avatar_choices img.selected{border:2px plain #39c;}
go figure.
Comments
Post a Comment