很简单,我正在寻找一种方法来抓取URL参数的值,并将其传递给按钮内的目标URL。
例如
页面URL: https:/example-domain.comage-1?parameter=value1。
在这个页面中,有一个按钮的链接网址。https:/example-domain.comage-2。
我正在寻找一种方法,让这个链接动态更新为 https:/example-domain.comage-2?参数=value1。
有没有一种方法可以让我在不懂任何编码语言的情况下处理我的Wordpress网站?
先谢谢你
我找到的解决方案是
<a href="TARGET_URL_HERE" id="ELEMENT_ID_HERE">LINK_TEXT_HERE</a>
<script type="text/javascript">
jQuery(function() {
var el = document.getElementById('ELEMENT_ID_HERE');
el.href = el.href + window.location.search;
});
</script>