Try charging the battery while the laptop is turned off (not sleep or hibernate but totally off). If it will charge then, but not when on, then it is probably the charger cord that is in need of replacing. Why? Well that happens when the cord is not putting out enough power to both run the device and charge the battery at the same time. Hence while it will charge when the device is turned off.
Now if it won't charge no matter if it is turned off or turned on, then you probably need a new battery.
NOTE: If the device is still under warranty, then contact the manufacture about replacement parts.