views:

410

answers:

2

Hi Guys,

I am testing some jQuery in Chrome/Safari and I just cant seem to solve this error. Basically, I am doing:

jQuery(':radio', '.some_class')
            .change(function() {
                jQuery('.special_class').show();
            })
            .blur(function() {
                jQuery('.special_class').hide();
      });

And I get no love at all ? Even tried

jQuery('.special_class').css('display','none');

And that aint help either - the ".some_class" shows fine but doesn't want to disappear?

Edit: HTML Code is:

<div class="some_class">
    <label for="button"><input type="radio" name="style" id="button" value="button" />Button</label>
</div>

    <div class="special_class">Hello There!</div>

Edit 2: What's even weirder is that when I "tab" - it works? but using "click" it aint?

Any ideas?

+1  A: 

The blur event doesn't mean "deselected". It means "lost keyboard focus". You will need to add some extra logic to your change event handler to detect whether the radio button was selected or deselected.

hey thanks duskwuff - any ideas what can add?
A: 

I think that there is a problem with "blur" event. Look here

Safari and Chrome don’t support these events on links and/or form fields in all circumstances.

Andrew Dashin