【发布时间】:2021-06-29 16:36:40
【问题描述】:
我有两个选择,我想用两者的值创建一个链接。但问题是,如果我进行选择更改,链接不会刷新。
const seOne = $('select[name=selectionOne] option').filter(':selected').val();
const seTwo = $('select[name=selectionTwo] option').filter(':selected').val();
if (seOne != null && seTwo != null) {
const goThereButton = document.getElementById("goThereButton");
goThereButton.textContent = "View";
goThereButton.classList.remove("btn-secondary");
goThereButton.classList.add("btn-primary");
goThereButton.href = appLink + 'page?scd=content&id=' + seOne + '&hsg=' + seTwo;
}
选择更改时如何刷新链接?
【问题讨论】:
-
你有没有尝试在两个选择的 onchange 事件中包装这个?
-
你显示的代码不足
标签: javascript html jquery input