JSFiddle - React, Tailwind, and code Playground
HTML
<a href="test.php"></a>
<input type="radio" name="radio" value="1"/>
<input type="radio" name="radio" value="2"/>
<input type="radio" name="radio" value="3"/>
<input type="radio" name="radio" value="4"/>
<div id="log"></div>
JavaScript
$.fn.logHref = function() {
$(this).each(function() {
$(this).click(function() {
log($(this).attr("href"));
return false;
});
});
function log(href) {
$('#log').html($('#log').html()+href+'<br/>');
}
}
$(function(){
$('input').live('click',function(){
$('a').attr('href','test.php?id='+$(this).attr('value'));
$('a').click();
});
$('a').logHref();
});