I'm trying to select the first radio button by default. However, every code I have tried has not worked. Any help would be appreciated.
jsfiddle - http://jsfiddle.net/te2b5dqy/
$('.radiogroup').change(function(e) {
const $this = $(this), $link = $("#url");
$link.html($this.val());
$link.attr("href", $this.attr("data-url"));
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="radio" name="radiogroup" id="radiogroup1" class="radiogroup" value="Google" data-url="https://google.com" />
<input type="radio" name="radiogroup" id="radiogroup2" class="radiogroup" value="Bing" data-url="https://www.bing.com/" />
<a id="url" href="" target="_blank">null</a>