I'm making a tiny script that adds a class of "external" to all external links, then when someone click an external link, it shows a div.question-wrapper that has a div.follow and a div.dontfollow in it, it also displays the url of the link you clicked in the div.question-wrapper. the only problem i'm having is copying the href attr of the link clicked to the button div.follow.
jquery:
$(".external").click(function() {
thisurl = $(this).attr('href')
$("#question-wrapper").fadeIn('normal')
$("#follow").attr('href', "($(this).attr('href'))")
return false;
$("#dontfollow").click(function() {
$("#question-wrapper").fadeOut('normal')
})
$("#question-wrapper span").html(
$(this).attr('href'))
return false;
})
html:
<div id="question-wrapper">
Would you like to continue on to
<span id="url">space where link is</span>?
<div id="follow">CONTINUE</div>
<div id="dontfollow">STAY HERE</div>
</div>