views:

285

answers:

2

Dear Stack

Can CSS be used to change the title attribute in this img tag to something more pleasant than P10305...? All the images I need to target are in tables (as shown below)

I would like to change all image title attribute in a website to the name of the company. Is it possible?

<td><img border="0" title="THIS THING HERE" src="http://the website I'm working on.jpg" /></td>

Many thanks Mike

A: 

not using strict css. However jQuery, and other javascript methods can be used to select that image and change it's title attribute.

$('td img').each(function() { $(this).attr('title', 'value') });

gives you a rough idea of how to use jquery to do this.

Check out the documentation to get a better idea: http://docs.jquery.com/

Bryan McLemore
I've chosen the first reply as the answer. Not because your was not as good, it's just that I don't know JQuery and therefore am not able to say who has written the best JQuery, so in order to close it I've chosen the first reply.
Mike
First as in newest (mine was the first reply)? Sidenote, his isn't using JQuery, it's using prototype.
Bryan McLemore
+1  A: 

This isn't possible with CSS, as CSS only affects styles. What you're asking for is a content change.

The change you want is possible with Javascript, however. If you happen to be using Prototype, it's pretty easy:

$$('td img').each( function( image ) { image.title = "Company Name" } )

jQuery should make this similarly easy too.

Hope that helps!

Sean McMains