How can I replace the word "Pipelines" to "NewText" in the following HTML code using JavaScript?
<a href="/v2/location/wrbZF5pqYXJwNagoqTEO/settings/pipeline" class="w-full group px-3 flex items-center justify-start sm:justify-center md:justify-center lg:justify-start xl:justify-start text-sm font-medium rounded-md cursor-pointer font-medium opacity-70 hover:opacity-100 py-2 md:py-2" id="sb_pipeline" exact-path-active-class="exact-path-active-class" meta="pipeline">
<!---->
<span class="hl_text-overflow hidden md:hidden nav-title lg:block xl:block hl_force-block"> Pipelines </span>
<!----><!----><!----></a>
I’ve tried using the following code to change the text content of the span element inside the a tag, but it didn’t work document.getElementById("sb_pipeline").getElementsByTagName("span")[0].textContent = "New Text";
2
Answers
Here is a simpler and much plausible way to go around your question.
Try using the following script