First, verify that all connections are firmly pushed into the computer / transformer/ socket. If not, firmly seat all wires.
Then, verify that there is electricity in the outlet you put the transformer into. If not, turn on the circuit breaker.
Then, verify that the transformer outputs proper voltage. You can do this with a cheap multimeter at the output tip of the transformer. Typically you should see 19–20V, sometimes you see a little more (for high-power laptops) or a little less (for netbooks and lower style laptops.) If the charger tip is a modern, very fine-pitch connector, like MagSafe or USB C, this may be harder — you may have to test the chargers voltage some other way. If this doesn’t work, look for a fuse in the charger. If the fuse is blown, replace it and try again. If not, find a new charger, and try again.
Then, if it’s still not charging, verify that the circuit in the laptop is correct. The connection jack in the laptop should be firmly seated to the circuit board. Components on the path from the power input to the battery should be in good shape — no burned smells, dead traces, black spots, cracked boards/wires, or similar. (You will need to open the laptop to check this out.) If this is the problem, a handy electronics person might be able to fix it for you, for whatever fee they charge.
If that doesn’t work, then verify that your battery is still good. Some batteries have built-in monitors; if that monitor doesn’t light up when you press it, it’s probably worn out. This is more likely the older your laptop is — before 1 year, no battery should wear out; after 2 years, batteries generally start wearing out; specific age varies by usage. If it’s a bad battery, you can fix it by replacing the battery with a new part of the same kind of battery, which you may be able to buy at various online shops, depending on the age and popularity of your laptop.
If none of that works, then either live with having to plug in to use the laptop, or buy a new laptop.