I've got some incons displaying in columns within my jqGrid which indicate that an invoice has been sent or that a pdf has been created. I've added alt text to the icons in the hope I could have some text to let non familiar users know what the icons mean however the alt text is not being disp开发者_Go百科layed. I've got a feeling this is to do with the way that the hover states on the rows work. I've tried disabling this but to no avail.
I was hoping there would be some kind of onhover event that I could query which column the user is on and display the text some way but there isn't anything like that either.
I'm stumped. How do I get around this?
The alt
attribute is for screenreaders (i.e. for the visually impaired), non-graphical devices, and sometimes as a placeholder for an image that fails to load (this depends on the browser).
For a tooltip effect, you want to set the title
attribute instead. For an example, hover your mouse over your reputation number in your flair below your question. Then, using a WebKit browser such as Chrome, do an "inspect element" and you'll see the title
attribute in the HTML.
The title
attribute of the corresponding <td>
element of the grid cell is responsible for the tooltips. You can include the title
attribute for the <img>
instead of <td>
, but in the case only the picture will have the tooltip and not on the full grid cell. See here a small demo. Look at this old answer which gives some links to different approaches to set tooltip on the grid cells.
If you want to set custom tooltips in the grid column it can has sense to switch off the creation of the standard tooltips with respect of title:false
property in the corresponding column definition of the colModel
. After that you can set tooltips on the cells inside of loadComplete
event handle.
精彩评论