How to select inside attribute javascript

I am trying to select text “Početna” inside of a and then change its value to “Home” using json file

// HTML part
<li><a class = "pocetnamenu"  href="#pocetna"><i class="fas fa-home"></i>Početna</a></li>

 // JS part
const pocetnamenuEl = document.querySelector('.pocetnamenu');

pocetnamenuEl.textContent = data[attr].pocetnamenu;

I am unsure where it went wrong


This is working:

pocetnamenuEl.textContent = "test";

So I’m pretty sure this underneath isn’t right. I guess some code is missing and this is coming from your json file? Try logging it.