radio button works only 1 time for all the different values

radio button works only 1 time for all the different values


  1. <html>
    <head>   

    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.css" />
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script>

    </head>
    <body>

    <div data-role="page" id="detail">
    <div data-role="header" data-theme="a">
            <h1 id="hdetail"></h1>
            <a href="#index" data-icon="back" class="ui-btn-left">Terug</a>
        </div>
    <div data-role="content"  data-theme="b">
    <div data-role="fieldcontain">
        <fieldset data-role="controlgroup">
            <legend>Userlevel:</legend>
                 <input type="radio" name="userlevel" id="k1" value="Gebruiker" />
                 <label for="k1">Gebruiker</label>

                 <input type="radio" name="userlevel" id="k2" value="Administrator"  />
                 <label for="k2">Administrator</label>

        </fieldset>
        <a href="#" data-role="button" id="Gb1">Gebruiker</a>
        <a href="#" data-role="button" id="Gb2">Administrator</a>
    </div>
           
    </div>
    <div data-role="footer">
        <h4 id="sdetail"></h4>
        </div>               
    </div>


    <script>


    $(document).on('pagebeforeshow','#detail',function(e,data){  
    $('#Gb1').click(function(){
             $('#k1').attr('checked', 'checked');
            $("input[type='radio']").checkboxradio("refresh");
            alert("2");
    });
    $('#Gb2').click(function(){
                 $('#k2').attr('checked', 'checked');
            $("input[type='radio']").checkboxradio("refresh");
            alert("3");
    });


    });

    </script>
    </body>
    </html>






























































Does anyone know why i could only change the value for the radio button 1 time?
After selecting a value for the second time the radio stays on the last value