how to avoid writing jquery repetitive code
<p>I have searched and the questions tab, I found the jqeury repetitive code question has been asked before, but I still can't understand how to apply it to my specific issue.</p>

<p>below is a simple code that changes the text in a box to red, blue and black, there are 3 of this boxes. how do I minimise this code to avoid repetition, thanks.</p>

<pre><code> $("div.box1").click(function () {
    colour=$(this).css("background-color");
    $("div.first").css("color", colour);
});

 $("div.box2").click(function () {
    colour=$(this).css("background-color");
    $("div.second").css("color", colour);
});

 $("div.box3").click(function () {
    colour=$(this).css("background-color");
    $("div.last").css("color", colour);
});
</code></pre>
