title: JQuery selecting radio button using a variable
body: <p>I'm trying to select a radio button using a variable but, although I can print the selected value the button does not stay selected.</p>
  
  <p>This button is defined in an angular template as follows:</p>
  
  <pre><code>&lt;a ng-click="selectNode($event, node)"&gt;
      &lt;input type="radio" name="library" style="float:left;" id="id-{{n}}" /&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>Where id is a GUID so is definitely unique.</p>
  
  <p>Then, because it is the angular click event that is called when a button is selected I call this code in selectNode:</p>
  
  <pre><code>context.selectedNodes = [node];
  $scope.selectedNode = node.$model.name;
  var id = '#id-' + node.$model.id;
  //console.log(typeof id);
  //console.log(id);
  $(id).prop("checked", true);
  alert($("[name=library]:checked").val())
  </code></pre>
  
  <p>Which should theoretically check the radio button. However, it checks for a moment (it is checked when I call the alert) and then seems to disappear. I am however able to hardcode in an id and it stays checked.</p>