The easiest way to connect your electric guitar or bass to your computer is to use one of the small guitar audio interfaces on the market. Just connect the cable from your instrument to the interface and you're ready to rock.
Here are two simple alternatives:
Apogee Jam is a simple interface to record electric guitar or bass. You plug the guitar into the device and then connect it to the computer USB port. It costs about $100 (Mac OS & Chrome OS). Check out this video to see how it works.
Behringer UCG102, costs about $40 (Mac, PC & Chrome OS)
If you have an audio interface with instrument/line input it works absolutely perfect as well!
(1) Add new track - Guitar/bass amp
(2) Settings - Sound setup