I am adding an image in a loop by iterating using struts tag. I've an image for which tooltip can vary depending on certain condtion.
I'm adding image in the following way inside a loop -
<logic:iterate> ....
<img src="../images/report_<bean:write name="vo" property="field(repType)" bundle="coreRes"/>.png" width="13" height="13" style="vertical-align: middle; cursor:pointer;" id = "repImg" onmouseover = "generateTooltip('<bean:jsParam name="vo" property="field(repType)" bundle="esmcoreRes"/>')"
</logic:iterate>
based on the repType value i'll be adding different images. For instance if repType returns "1" i'll add an image as "A", if "2" image will be "B" . Now i need to add a tooltip which will display different values depending on the reportType.
below is the javascript code i tried -
function generateTooltip(repType){
var tooltip = '';
// logic to determine tooltip based on repType is written here
//$('#repImg').prop('title', tooltip );
$("#repImg").attr('title', tooltip );
//$("#repImg").css('cursor','pointer').attr('title', tooltip );
}
I've tried several approach in Javascript method mentioned above. But the tooltip is getting displayed only for the 1st image. For rest of the images tooltip isn't getting displayed.
Can anyone help me on this.