如何通过 Javascript 编辑此特定 class 的 href?

How can i edit the href of this specific class via Javascript?

我知道如何通过 Javascript 更改此 href link,你们能帮帮我吗?

我要改的link是上面的:

Html Screenshot of the Link here

<div class="view-project vp-global  font_rs0r6bbli"><a href="http://decatejo.pt/video-hp">SABER MAIS</a></div></div><div class="section">

您可以使用 query selector..

获取元素
let element = document.querySelector('.fp-tableCell .view-project.font_re0r6bbli a');

element.href="example.php";

但与其通过 class 获取元素,我建议使用特定的 ID。

您可以使用 document.querySelector('.view-project.vp-global.font_rs0r6bbli a').href 设置 class 中 a 标签的 href 值。在 link 上使用浏览器的检查元素来检查正在更改的 href 值。

var newHref = 'www.google.com';
document.querySelector('.view-project.vp-global.font_rs0r6bbli a').href = newHref;
<div class="view-project vp-global font_rs0r6bbli"><a href="decatejo.pt/video-hp">SABER MAIS</a>