无法使用Twipsy将null转换为对象

Cannot convert null to object using Twipsy

本文关键字:null 转换 对象 Twipsy      更新时间:2023-09-26

我在我的Web应用程序中使用Twitter引导程序,在我的资料页中,我执行以下

    <%--Referencing jQuery--%>
<script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>
<%--Referencing the bootstraper script--%>
<script src="http://twitter.github.com/bootstrap/1.4.0/bootstrap-twipsy.js" type="text/javascript"></script>
<%--My Script--%>
<script type="text/javascript" language="javascript">
    $(document).ready(function () {
        $("a").twipsy();
    });        
</script>

然后在页面(Default.aspx)中,代码ia有一个这样的链接:

<a href="#" id="example" class="classeTeste" title="Some title text">text</a>

当运行页面时,twipsy(一种样式化的工具提示)不起作用。看看这里,看看twipsy在行动(http://twitter.github.com/bootstrap/javascript.html#twipsy)

我看到了"正常工具提示"

检查chrome控制台时,我看到以下脚本错误未捕获类型错误:无法将null转换为对象(bootstrap twipsy.js:315)

怎么了?

您的JQuery版本太旧,这可能就是原因。

另一种可能性是,您的选择器是$("a"),而不是id,$("#mylink")。不过,文档建议它应该与集合一起使用。