【问题标题】:jquery-ui brokenjquery-ui坏了
【发布时间】:2012-04-25 02:22:08
【问题描述】:

两个月前我一次创建的脚本不起作用。 我已尝试恢复备份文件,但没有任何更改。 这个问题出现在所有使用 google apis 脚本的网站上 我使用的函数是 .button() .corner()

链接和脚本:

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>       
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.18/jquery-ui.min.js"></script>  
<script src="http://malsup.github.com/jquery.corner.js"></script>  

错误:

BlockquoteUncaught 异常:TypeError:无法将 '$("#BuyCredit")' 转换为对象

http://www.t-samp.net/credit-shop.php () 中的第 3 行第 6 列抛出错误: $("#BuyCredit").button().click(function() { 通过 http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js 中 (b, f) 中的第 2 行第 29359 列的 Function.prototype.apply() 调用: if(c[m].apply(b,f)===!1&&a.stopOnFalse) 从http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js (b, c) 中的第 2 行第 30902 列调用: d&&(j?a.once||d.push([b,c]):(!a.once||!e)&&o(b,c)); 从http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js (a) 中的第 2 行第 19036 列调用: A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready") 从http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js () 中的第 2 行第 28469 列调用: c.removeEventListener("DOMContentLoaded",B,!1),e.ready()

我的脚本:

<script>
    $(document).ready(function() {
      $("#BuyCredit").button().click(function() {
        $(".buycr").corner();
        $(".buycr").css("display","block");  
      }); 
    });
  </script>

我的 HTML:

<div class="buycr" data-corner="15px">
  <div style="width:280px">Text</div>
</div>
<div style="width:100px">
      <span id="HideBox">Zavřít</span>
    </div>

感谢您的反馈

【问题讨论】:

  • id 为“BuyCredit”的 div 在哪里?错误是 $('#BuyCredit') 不返回任何项目

标签: jquery jquery-ui


【解决方案1】:

您正在链接到两个不同版本的 jQuery

<script src="http://code.jquery.com/jquery-latest.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

尝试摆脱最新的(假设它之前在 1.7.2 上工作)。

[edit] 既然这不起作用,最好的猜测是无论#BuyCredit 是什么都不再存在了。这可以解释错误Cannot convert '$("#BuyCredit")' to object

确保您的页面上有#BuyCredit

【讨论】:

  • 我尝试删除第一个脚本,在第二个脚本之后将版本号更改为 1.6 和 1.5。但没有变化:(
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-02-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-30
  • 1970-01-01
相关资源
最近更新 更多