Grasp and pull the knob away from the stove. If the knob does not come off, slide a piece of wire or a rubber band under the knob, and pull it forward until the knob comes off.
Line the new knob up to the switch and ensure the tracking on the back of the knob lines up appropriately to the switch.
Push the knob onto the switch until you feel it snap into place.
Test that the knob is on securely by turning the knob clockwise and counter-clockwise and ensuring it is working properly.