Here’s a sample with 5 dropdowns.
Page 1 uses plain JS to check wether all dropdowns are populated and whether there are doubles in the selections.
Page 2 does the same, just “On: Select / Change”
It may be a little easier to understand where to put code depending on the situation empty or doubles.
Page 3 uses that jQuery code from stackoverflow
By the way: you can never paste actions to a dropdown that doesn’t have actions attached already, but you can paste an action under an existing action and drag the copy to the next dropdown.