Javascript simpletip动态内容加载帮助

Javascript simpletip动态内容加载帮助,javascript,jquery,Javascript,Jquery,我正在尝试使用simpletip从数据库加载内容。我的代码: <script type="text/javascript"> $(document).ready(function(){ $('a.regularsList').simpletip({ onBeforeShow: function(){ this.load('/regulars/tooltip', {id: $(this).attr("id

我正在尝试使用simpletip从数据库加载内容。我的代码:

<script type="text/javascript">

    $(document).ready(function(){
        $('a.regularsList').simpletip({
            onBeforeShow: function(){
                this.load('/regulars/tooltip', {id: $(this).attr("id")});
            }
        });
    })

$(文档).ready(函数(){
$('a.regularlist').simpletip({
onBeforeShow:function(){
load('/regulars/tooltip',{id:$(this.attr(“id”)});
}
});
})

我知道那个id没有定义。我不明白我做错了什么,因为我试图访问id属性的值

在当前代码
中,此
指的是
文档
,而不是在此处使用循环,以便
指的是您想要的锚,如下所示:

$(function(){ //short for $(document).ready(function(){
  $('a.regularsList').each(function() {
     var a = this;
     $(this).simpletip({
        onBeforeShow: function(){
          this.load('/regulars/tooltip', { id: a.id });
        }
    });
});

在循环中,
this
引用当前正在查看的
a.regularlist
元素,因此您可以使用
this.id
获取
id
属性。

仍然会导致相同的问题。无论我使用this.id还是$(this.attr('id'),我在firebug控制台中仍然没有定义。@user253530-woops,
引用了该函数中的对象,需要存储引用,检查更新的答案:)我的代码:我正在zend_框架中使用PartialLop来显示所有链接。