Turn off the power - remove the cover of the switch fit the new cord and pass it through the hole in the switch cover and put the cover back on.
Sometimes over-painting of the switch makes it difficult / impossible to remove the cover without smashing it to pieces first. In these cases a complete new switch is required.
Peccavi
August 2013