首页 > 解决方案 > 如何动态更改 PayPal 货币代码

问题描述

我试图在 PayPal SDK 中动态更改货币代码,但被堆叠了。当用户点击货币下拉菜单时,它会自动更改货币的占位符。

下拉代码

  <span class="input-group-text bg-white border-right-0"> 
    <select class="form-select form-select-lg border-0 " width="3px" id="currency" aria-label=".form- 
       select-lg example">
        <option value="USD" selected>USD</option>
        <<option value="AUD">AUD</option>
     </select>
  </span>

脚本

<script type="text/javascript">
        var currency = document.getElementById("currency").value;
        
    </script>
    <script src="https://www.paypal.com/sdk/js?client-id=secret&currency=currency"></script>

标签: javascripthtml

解决方案


推荐阅读