Question: I am going to use on of the tooltip plugins listed in this question: [jquery tooltip, but on click instead of hover](https://stackoverflow.com/questions/1313321/jquery-tooltip-but-on-click-instead-of-hover)

How would I also setup a tooltip that randomized the text shown. For instance if you click a link you could be shown one of three possible messages:

Message 1
Message 2
Message 3

ideas?

Answer: 
You usually have an array of messages and then generate a random index onclick. 

something like

```
 var messageArray = ["message 1", "message 2", "message 3"];
 var randomNum = Math.floor(Math.random()*messageArray.size);
 var myMessage = messageArray[randomNum];

```

or something like that. refactor to use ajax/your db if you need to
```
var messages = ['Message 1', 'Message 2', 'Message 3'];

$('.withTooltip').click(function(){
  $("#tooltip").text(messages[Math.round(Math.random() * 3)]).show();
});

```