Still not sure where the descriptions are coming from?? Are they stored in, and retrieved from, a database?
Anyway, although I mentioned title
, I would generally prefer not to use it. You can use 'data-*' HTML5 attributes which are supported by the jQuery data
<img id="thisone" src="whatever.gif" data-desc="Here be a description." height="100" width="100">
If you are using JS to create data-* attributes (after
the page has loaded) then you need to use setAttribute
(), or attr
() in jQuery.
FWIW If you are running JS/jQuery code after
the page has loaded you can just invent your own properties and attach them to DOM elements:
var myImage = document.getElementById("thisone");
// jQuery: var myImage = $('#thisone');
myImage.anyPropertyIFancy = "Ta Da!";
These properties can then be read directly by your code, but this is probably not relevant to your current code.