The independent evolution of morphological similarities is widespread1,2For simple traits, such as overall body colour, repeated transitions by means of mutations in the same gene may be common3-5. However, for more complex traits, the possible genetic paths may be more numerous; the molecular mechanisms underlying their independent origins and the extent to which they are constrained to follow certain genetic paths are largely unknown. Here we show that a male wing pigmentation pattern involved in courtship display has been gained and lost multiple times in aDrosophilaclade. Each of the cases we have analysed (two gains and two losses) involved regulatory changes at the pleiotropic pigmentation geneyellow.Losses involved the parallel inactivation of the samecis-regulatory element (CRE), with changes at a few nucleotides sufficient to account for the functional divergence of one element between two sibling species. Surprisingly, two independent gains of wing spots resulted from the co-option of distinct ancestral CREs. These results demonstrate how the functional diversification of the modular CREs of pleiotropic genes contributes to evolutionary novelty and the independent evolution of morphological similarities.