tags:

views:

289

answers:

2

Hi ,

I am using JQuery for the first time and need help.

When i click on a anchor tag it calls a html div and shows up a popup(JqueryCluetip Plugin)

<a class="tips" href="#kt" rel="#kt" title="Kate Thompson">more info...</a>

I have this cluetip function:

$(document).ready(function() {
$('a.tips').cluetip({
 cluetipClass: 'rounded',
 dropShadow: false,
 showtitle: false,
 positionBy: 'mouse',
 local: true,
 hideLocal: false,
 sticky: true,
 width: 410,
 closeText: 'Close'
});

});

Now my question is i want to pass parameter called userid to the anchor tag so that the popup shows differnet data based on input paramter. (Basically i have to pass that id to a backing bean and get the corresponding user details for that id and show it up in the popup.) Please let me know how can i perform this task.

A: 

You could add an arbitrary attribute to the element called 'userid' and get it out of the anchor object when you need it.

Thanks for your reponse. Please let me know what exactly yo mean by an arbitary attribute?
vishnu
Sure. It means just add an attribute that you name, such as 'userid'.like this:<a href="#" userid="[userid here]">link</a>Now you can access the 'userid' attribute in jQuery like this:var userid = $( a ).attr( 'userid' );I hope this helps.
A: 

more info...

Andrew