If the light isn't working when you open the tailgate:
1. Check the Bulb: The most common reason is a burned-out bulb. Access the bulb (usually located in the tailgate itself) and replace it with a new one of the correct wattage.
2. Check the Fuse: Check your owner's manual for the fuse that controls the tailgate/cargo area light. Locate the fuse box (usually under the hood or inside the cabin) and check the fuse with a test light or by visually inspecting it for a broken filament. Replace it if necessary.
3. Check the Wiring: If the fuse is good and the bulb is good, there might be a problem with the wiring in the tailgate harness. This can be caused by wear and tear, corrosion, or a broken wire. This requires a more advanced troubleshooting approach which might involve tracing the wiring or seeking professional help.
4. Tailgate Switch: The tailgate itself might have a switch that activates the light. Examine the tailgate carefully for any switches that could be malfunctioning or dislodged.
If you've checked these and the light still doesn't work, you'll likely need to consult a wiring diagram for your specific 1998 Ford Ranger XLT or take it to a mechanic or auto electrician.