Attach one event handler and make this one handler to decide what to do randomly.
For example, in C # you can:
private readonly Random rng = new Random(); ... button.Click += TakeRandomAction; ... private static void TakeRandomAction(object sender, EventArgs e) { if (rng.Next(2) == 0) { GiveUserPony(); } else { NukePlanetFromOrbit();
Details may vary in jQuery / JavaScript, but basically you should still make an onclick call to one function, which then worked out what to do.
source share