jQuery: Fire only once with multiple binds

This fires twice if I click on my radio button:

 $('.xyz input').bind('change click', function(){
  alert('Hello');
 });

Open in new window


How can I get it to fire only once, either if is clicked on or changed?
LVL 16
hankknightAsked:
Who is Participating?
 
David S.Connect With a Mentor Commented:
Yes, the click event will fire even if the keyboard is used to select the radio button instead of the mouse.
0
 
BuggyCoderConnect With a Mentor Commented:
use this:-
$('.xyz input').click(function(){
  alert('Hello');
 });

Open in new window

0
 
David S.Commented:
I agree with BuggyCoder.  The change event is only triggered on radio buttons in IE (or at least some versions of it) after the radio button loses focus, so it's best to just use the click event.
0
 
hankknightAuthor Commented:
Will click fire even if the radio is changed by the keyboard?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.