问题描述:

Here's my javascript:

$(".more_info").hide();

$(".checkbox.has_info, .has_info").focus(function(){

$(this).parent().next().next().show("fast");

});

$(".checkbox.has_info, .has_info").blur(function(){

$(this).parent().next().next().hide("fast");

});

Note, that this works perfectly in Firefox/ IE7, IE8.

So far I have discovered that this is because Safari and Chrome do not accept the focus/blur events for check box or radio buttons. Anyone know a work around that still has the same effect?

网友答案:

Yes! Here it is folks! Amazing!

$(".more_info").hide();

var $info_items = jQuery('.checkbox.has_info, .has_info')
$info_items.click(function(){
  var $info_item = jQuery(this);
  $info_items.filter(function(index){
    return $(".hidden_text").css("display","block");
    }).not($info_item).parent().next().next().hide("slow");
  $info_item.parent().next().next().show("fast");
});
相关阅读:
Top