Figure 1. Various jack arrangements.
J1 is wired for single input. When the jack is disconnected it shorts the input to ground to silence it.
J2 and 3 are wired in series to give priority to J2. Put a plug in J2 and it disconnects J3. Pull J2 out and J3 becomes effective or grounded if both plugs are out.
For the output you could consider the arrangement J4 which will connect the output to R1 if the jack is unplugged.
[From OP's comment:] At the output I'm not using a jack but a speaker (i.e. two terminals). I guess that the positive is connected to the output and the negative to ground, but I'm not sure. Is this correct?
Yes.
Strictly speaking audio doesn't have a + or - since it's an alternating current. However, for stereo amplification it is important to wire the speakers in phase so that they both push and pull together. Getting them backwards results in cancellation of the bass and a slightly strange void in the middle of the stereo image. For this reason the terminals are often marked + and - on each channel and the 2-core cable will have a marker or stripe on one of the cores.
Convention is that that if one leg of the speaker is connected to amplifier ground then that would be marked as -.
simulate this circuit – Schematic created using CircuitLab
Figure 2. Single ended and bridged amplifier setups.
Bridge-mode amplifiers often seen in car stereos use two amplifiers working in opposition on each channel to double the voltage output and get up to four times the output power. This is necessary because the power supply is limited to 12 to 14 V. In these cases neither input is connected to ground but + and - would still be used to indicate correct phasing.