2

我在我的 asp.net 页面中有 jQuery qtip() 函数,我需要从单击的项目中获取 id。有谁知道该怎么做?

例如,请在下面找到我的脚本代码...

$("#content a.toolTip").qtip({
     content: { url: 'PageView.aspx?Param=' + '---get id---'  }
)};

提前致谢。

[]'rpg

4

3 回答 3

6

如果您想this在设置 qtip 时通过引用元素,您可以在.each(). 那就是this指当前元素。

$("#content a.toolTip").each(function() {
        // Now "this" is a reference to the
        //    element getting the qtip
        // Get the ID attribte -------------------------------v
    $(this).qtip({ content: { url: 'PageView.aspx?Param=' + this.id } });
});
于 2010-08-13T20:37:20.130 回答
0

如果需要获取一些参数,可以这样作弊;)

$("#content a.toolTip").each(function()
{
    $(this).qtip({
        content: { url: 'PageView.aspx?Param=' + $(this).attr('id')  }
    });
});
于 2014-06-19T10:18:44.427 回答
0

$("#content a.toolTip").qtip({

内容:{ url: 'PageView.aspx?Param=' + $( this ).attr( 'id' ) }

)};

于 2010-08-13T20:23:34.653 回答