- $("label.legend, label.childless").click( function(event){
+ $("label, input").click( function(event){
... and then some cosmetics to keep radio labels at place.
Andrejs Cainikovs
2009-08-03 19:59:50
- $("label.legend, label.childless").click( function(event){
+ $("label, input").click( function(event){
... and then some cosmetics to keep radio labels at place.
Use the focus event on the radio button instead. Try this:
<script type="text/javascript">
$(function(){
accordionOptions();
});
var accordionOptions = function(){
$("label.legend > input, label.childless > input").focus(function(event) {
var el = $(this).parent();
var opposites = $(".subtype").not(el.next());
opposites.find("input:checked").attr("checked", false);
opposites.removeClass("expanded");
el.siblings("label").removeClass("expanded");
el.next(".subtype").toggleClass("expanded");
el.toggleClass("expanded");
});
}
</script>
This works in my end:
$("label.legend, label.childless").click( function(event){
var opposites = $(".subtype").not($(this).next());
var el = $(this);
opposites.find("input:checked").removeAttr('checked');
opposites.removeClass("expanded");
el.siblings("label").removeClass("expanded");
el.next(".subtype").addClass("expanded");
el.toggleClass("expanded");
});
That being exchanging toggleClass for addClass.