0

我想在 wpbakery 中使用此代码在每次页面刷新时强制加载 iframe。iT 在 html 网站上工作,现在它不工作 说:

Uncaught TypeError: $ is not a function about this line

iframe = $('#firstPage');

完整的代码是这样的......

<iframe id="thirdPage" height="1270" width="1800" frameborder="0" scrolling="no"> </iframe>
           
           <script>
               
                var d = null;
  var iframe = null;
  d= new Date();
  var unique = d.getTime();
  
     unique++;
    iframe = $('#thirdPage');
    iframe.attr('src','https://www.ubs.com/global/en.html?g='+unique);

              </script>

你能帮忙吗?

4

1 回答 1

0

看来您需要将 jQuery 添加到您的页面中。试试这样:

<iframe id="thirdPage" height="1270" width="1800" frameborder="0" scrolling="no"> </iframe>
           
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
               
  var d = null;
  var iframe = null;
  d= new Date();
  var unique = d.getTime();
  
  unique++;
  iframe = $('#thirdPage');
  iframe.attr('src','https://www.ubs.com/global/en.html?g='+unique);

</script>
于 2020-11-01T08:18:40.217 回答