Trumpet valves come loose when the trumpet valve guide erodes or the spring that pushes the valve back to an open position is strung too loosely. In some instances, if there is perceivable damage to the valve, an instrument repairman must be consulted. However, in most cases, the loose trumpet valve only needs a little adjusting to get the valve back in working condition. Don't attempt a repair unless you have confidence in your ability to work on your instrument without damaging the valves. Even the slightest scratch on the trumpet valve impairs performance.
Remove the loose trumpet valve by turning the top valve cap counterclockwise. Pull the valve straight up and out of the valve casing.
Turn the trumpet upside-down to allow the spring to fall out of the valve casing.
Measure the length of the spring. The spring should be 1-inch long when relaxed and not compressed. If the spring measures less than 1 inch, stretch the spring by pulling on the top and the bottom of the spring until it extends just past 1-inch. Drop the spring back into the valve casing.
Investigate the valve guide at the top of the valve. The valve guide is a small strip of plastic or metal about 3 mm wide and 1/4-inch long. It attaches to the side of the valve and ensures that the valve moves straight up and down. If the valve guide has knicks or other damage you will need to replace it.
Replace the valve guide by using a 1/8-inch slot screwdriver and turning the screw that holds the valve guide in place counterclockwise. Pull up on the valve guide and replace it with the new valve guide. Secure the valve guide by replacing the screw and turning clockwise.
Make sure you oil the valves to ensure proper lubrication and a smooth action after you have repaired your instrument.
Consult a professional in a local music store if the valve has scratches or you are unsure of your ability to repair your trumpet.