select radio
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<form action='#' method='get'>
<input type="radio" name="radio1" id="yearly" value="yearly"><label class="yearly-label four col" for="yearly">I have some text here</label>
<input type="radio" name="radio1" id="quarterly" value="quarterly"><label class="yearly-label four col" for="yearly">quarterly</label>
<input type="radio" name="radio1" id="weekly" value="weekly"><label class="yearly-label four col" for="yearly">weekly</label>
</form>
<a id="samcart" href='#' data-url='http://exmaple.com'>sam cart url</a>
JavaScript
$(function(){
console.log("start");
$('input[type=radio][name=radio1]').on('change', function() {
console.log("event",$(this).val());
if ($(this).val() == 'yearly') {
$('#samcart').data("url", "www.urlhere.com");
$('#samcart').html("www.urlhere.com");
var a = $('#samcart').data('url');
} else if ($(this).val() == 'quarterly') {
$('#samcart').data("url", "www.url2here.com");
$('#samcart').html("www.url2here.com");
var a = $('#samcart').data('url');
} else {
$('#samcart').data("url", "www.url3here.com");
$('#samcart').html("www.url3here.com");
var a = $('#samcart').data('url');
}
alert("new data-url: "+a);
});
})