我在我的 asp.net 页面中有 jQuery qtip() 函数,我需要从单击的项目中获取 id。有谁知道该怎么做?
例如,请在下面找到我的脚本代码...
$("#content a.toolTip").qtip({
content: { url: 'PageView.aspx?Param=' + '---get id---' }
)};
提前致谢。
[]'rpg
如果您想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 } });
});
如果需要获取一些参数,可以这样作弊;)
$("#content a.toolTip").each(function()
{
$(this).qtip({
content: { url: 'PageView.aspx?Param=' + $(this).attr('id') }
});
});
$("#content a.toolTip").qtip({
内容:{ url: 'PageView.aspx?Param=' + $( this ).attr( 'id' ) }
)};