I want to make an image which, when clicked, displays some additional information about the image, such as the title. Below is some code I have tried, which seems to work. However, this was just after deciding on my own to try adding a custom attribute "title", rather than reading somewhere that this was the way to do this. So, even though this works for me, I would like to know whether this is good practice, or whether there is a recommended way to do this?
HTML:
<img id="test_image" src="images/image1.jpg" title="Test Image">
jQuery:
$("#test_image").click(function()
{
alert(this.title);
});
alert($(this).attr("custom"));However, I would recommend against this