A laptop can lose its ability to hold a charge due to battery deterioration. To fix this, try turning off the computer and remove its battery and AC adapter, and re-install them after 10 seconds. Hold down the power button of your laptop for 30 seconds to see if it reboots and holds a charge without the AC adapter plugged in. Sometimes, it may be a battery issue, such as dust accumulation or battery deterioration, so try to remove the battery, remove the dust with a microcloth and re-install the battery, or completely replace it. In addition, check to see if your AC adapter is the correct one for your laptop- it may be made by a different company or contains different wattage that your laptop requires. If the battery and AC adapter does not seem to cause the problem, you may have to re-install the driver. For Dell users, this option can be found in the device manager tab > battery settings > Microsoft ACPI-Compliant Control Method Battery > Right-click Uninstall driver > Accept changes and install the driver again
Hope that helps!