Checkbox - Add / Check / Change text

jQuery Mobile

by Riccal

HTML

<input id="s1" type="radio" name="aasd[]">asd
<input id="s2" type="radio" name="aasd[]">ass
    
<a href="#" id="1" class="check">ddd</a>   
<a href="#" id="2" class="check">asdasd</a>

JavaScript

// Dynamically 'Check' Radio buttons
$('.check').on('click', function () {
    var $this = $(this);
    var id = $this.attr('id');

    $('#s'+id).each(function () {
        if ($(this).is(':checked')) {
            $(this).prop('checked', false).checkboxradio('refresh');
        } else {
            $(this).prop('checked', true).checkboxradio('refresh');
        }
    });
});