<script type="text/javascript">
$(function() {
$('.thelink a').select(function() {
var a_href = $(this).attr("href");
});
$('.calltoActionMoreInformation a').attr('href', a_href);
});
</script>
<div class="thelink" style="height: 250px; position: relative;">
<a title="xxx" href="xxx">
<img alt="tree" src="x" />
</a>
</div>
Trying to put the href from a inside into:
<span class="calltoActionMoreInformation" style="position: absolute; bottom: 0px;">
<a title="" href="--Link here--"></a>
</span>
If I set var a_href = ‘http://www.google.co.uk’; it sets it correctly, so the problem lies within getting the href of the only a link within .thelink div..
How do I assigned the href in .thelink a to .calltoActionMoreInformation a ?
1 – the variable “a href” is not accessible from the global context, but only the select function.
2 – why use “select” function “click” is more appropriate in this case
correction :
is it right ?