If those confirm the battery is not charging or not holding a charge, you would need to replace it.
If those confirm the charger is not working, you would need to replace that.
If both the battery and charger check out OK, then it's an internal problem with the circuitry in the laptop, and unless the laptop is still under warranty, it's likely to cost more to fix that than to replace the laptop, outright.
***If my post helped, click the thumbs-up symbol to say thanks***
***Please mark Accept As Solution if my post solved your problem***
I am a volunteer and I do not work for, nor represent, HP
Be alert for scammers posting fake support phone numbers and/or email addresses on the community. If you think you have received a fake HP Support message, please report it to us by clicking on "Flag Post".