I'm kind confused on how to use jquery each store value from link then assign it new to link element.
Here's the markup.
<div class="box">
<a href="linkhere">Title</a>
<a href="transferhere" class="mybtn">New Link</a>
</div>
<div class="box">
<a href="linkhere">Title</a>
<a href="transferhere" class="mybtn">New Link</a>
</div>
<div class="box">
<a href="linkhere">Title</a>
<a href="transferhere" class="mybtn">New Link</a>
</div>
Here's what I did
$(".box").each(function(){
var hyperLinkValue = $('.box > a').attr('href');
$('a.mybtn').attr("href", hyperLinkValue);
});
but it doesn't seem to work?. Any thoughts?