html 将页面的URL添加到隐藏字段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 将页面的URL添加到隐藏字段相关的知识,希望对你有一定的参考价值。

<!-- START code for adding page URL to a hidden field -->
<script>
    $(document).ready(function() {
        var currentUrl = window.location.href;
        var fieldLabel = 'url';
        $('input[name="' + window.btoa(fieldLabel) + '"]').val(currentUrl);
    });
</script>
<!-- END code for adding page URL to a hidden field -->

以上是关于html 将页面的URL添加到隐藏字段的主要内容,如果未能解决你的问题,请参考以下文章