Good day. I am wondering is there any short script to apply the actual page title into the image title? So if I have this page title in my head section:
<head>
<title>Dogs</title>
</head>
and these images:
<a class="sth" href="#" title="PROBLEM"><img src="img01.jpg" alt="sth"/></a>
<a class="sth" href="#" title="PROBLEM"><img src="img02.jpg" alt="sth"/></a>
<a class="sth" href="#" title="PROBLEM"><img src="img03.jpg" alt="sth"/></a>
I want to dynamically apply the title where it says "PROBLEM" from the page title. What is the easiest way of doing this? Does it need to be in php or can it be in javascript?
I just want "Dogs" to go in the place where "PROBLEM" is at the moment if you know what I mean. So probably "PROBLEM" needs to be replaced by a simple script. The document must remain a html by the way.
var title = document.title;
$('.sth').attr('title',title);
Edit, but I don't really see the point of doing this. The title of the site has little to do with the images, if it's added to all of them, what is the point anyways?