Sounds like you have a failing battery. Many devices will power on and be functional when connected to power such as a charger or PC, even when the battery is failing. Sounds as if your battery is no longer able to hold a charge. The big indicator for me is you can use it when connected to a charger but once removed it shuts right off. That's almost always a battery issue.
+
+
You can follow this guide to help replace the battery.
Sounds like you have a failing battery. Many devices will power on and be functional when connected to power such as a charger or PC, even when the battery is failing. Sounds as if your battery is no longer able to hold a charge. The big indicator for me is you can use it when connected to a charger but once removed it shuts right off. That's almost always a battery issue.