I have a HTML which looks like:
I want to replace the word Search:
with another word some word
. How can I do this? I tried:
document.querySelector("#state-covid-data_filter label").innerText = "some word"
but this also replaces the input
tag.
I also tried:
document.querySelector("#state-covid-data_filter label").innerHTML = document.querySelector("#state-covid-data_filter label").innerHTML.replace("Search:","Some word:")
But then the input
tag loses the events registered. How could I just replace the text
such that everything else remains fine.