<div id="tile">
<a href="#" title="some other title"><img src="#">
<div id="newTitle">
<h1>I want the real title here</h1>
<p>some useful paragraph</p>
</div>
</a>
<a href="#" title="some other title"><img src="#">
<div id="newTitle">
<h1>Another title here</h1>
<p>another useful paragraph</p>
</div>
</a>
</div>
I want to change the anchor titles with the respective DIVs within that anchor using jquery
does anyone have a solution for this?
here's what I've tried:
<script>
var eachTile = $("#tile > a"),
newTitle = eachTile.children("#newTile").text();
eachTile.attr('title', newTitle);
</script>
this script shows all texts in one line so all of them has the same text.