Here is my recommend method of how to change guitar strings on an electric guitar. This method works great for guitars that have a hole in through the tuning post. Get in the habit of winding the strings on your electric guitars this way, and you won't have to worry about string slippage.
Attach the string to the bridge of your guitar. Exactly how you do this depends on the brand and type of guitar you have, but it should be easy to figure out.
Align the tuning peg with the strings. Thread the string through the hole of the tuning peg until there is about 5 cm (or 2 inches) of slack.
Bend the extra protruding string towards the centre of the head stock, and put it underneath the string.
Bend the string sharply upward and and turn the tuning peg in the right direction until the string starts to tighten - see video for example of what direction to turn the peg.
Make sure to stretch the string by pulling it upward a few times. Doing so will increase the tuning stability, as new strings are always a bit "stretchy".
Tune the string with a tuner, stretch again, tune again, and repeat this until it stays in tune.
Cut off the excess string with a wire cutter.
Repeat this same process for all the remaning strings.