Welcome to Tom's Hardware Forums,
There are two possibilities that immediately come to mind,
1) battery is worn out, needs replacement or
2) Power jack has gone bad and needs replacement.
There are a few other issues that may cause that but if you can use it no problem while plugged in, I would suspect the battery first.