在php中,我具有此链接,该链接将基于数据库中的数据在循环中多次生成
我的JavaScript脚本来更改链接
let link_id = document.getElementById("modal_btn");
let modal_btn = document.getElementById("save-changes");
link_id.addEventListener("click", urlChange);
function urlChange() {
let url = "<?php echo $url; ?>";
link_id.setAttribute('href', url);
}
php粗输出
//each of these $row['link'] will be a individual link from the database
<a href="<?php echo $row['link']; ?>" target="_blank" class="link_title">1</a>
<a href="<?php echo $row['link']; ?>" target="_blank" class="link_title">2</a>
<a href="<?php echo $row['link']; ?>" target="_blank" class="link_title">3</a>
<a href="<?php echo $row['link']; ?>" target="_blank" class="link_title">4</a>
当单击此按钮的modal will be opened时,按钮“保存更改”的href将更改为$ row ['link']的href,我该如何做,以便该链接位于一旦我单击了另一个链接,模态将继续更改为一个新链接?