If the light switch is in a junction box and there are screws securing it to the electrical panel, remove the screws and pull off the cover. If the light switch is not in a junction box, or if there are no screws, gently pry up on one of the edges of the switch housing and pull out the wire connector. Strip 1/2 inch of insulation off of each end of the wires and connect them to the Phillips-head screw terminals on the new electrical box. Replace the housing and screw it back into place.