user419973
user419973

Reputation: 23

jQuery qtip() - how to get the id from the clicked item

I have the jQuery qtip() function in my asp.net page and I need to get the id from the clicked item. Does anyone know how to do it?

As an example, please find below my script code...

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

Thanks in advance.

[]'rpg

Upvotes: 2

Views: 3293

Answers (3)

Novasol
Novasol

Reputation: 947

If you need to get some parameters, you can cheat like this ;)

$("#content a.toolTip").each(function()
{
    $(this).qtip({
        content: { url: 'PageView.aspx?Param=' + $(this).attr('id')  }
    });
});

Upvotes: 0

user113716
user113716

Reputation: 322452

If you want to reference the element via this when setting up the qtip, you could do your setup inside of an .each(). That way this refers to the current element.

$("#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 } });
});

Upvotes: 6

ovais.tariq
ovais.tariq

Reputation: 2625

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

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

)};

Upvotes: 0

Related Questions