title: Dynamically Show/hide text based on radio button select
body: <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;body&gt;
  &lt;p&gt; Is the time stamp bold and italsized&lt;/p&gt;
  &lt;label&gt;Yes&lt;/label&gt;
  &lt;input type="radio" id='rb1' name="first" value="Message 1" class='q1'&gt;
  &lt;label&gt;No&lt;/label&gt;
  &lt;input type="radio" id='rb2' name="second" value="Message 2" class='q1'&gt; 
  &lt;br&gt;
  &lt;div class="answer"&gt;
  &lt;/div&gt;
  &lt;script&gt;
  $('.q1').change(function() {
      $('.answer').html($(this).val());
  });
  
  $('input').keydown(function(e) {
    var code = (e.keyCode ? e.keyCode : e.which);
    switch (code) {
      case 89: // y
        $('#rb1').prop('checked', true);
        break;
      case 78: // n
        $('#rb2').prop('checked', true);
        break;
    }
  });
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This code does exactly what i wanted but however, the text does not change dynamically when using shortcuts.The correct buttons are checked when either "y" or "n" is pressed, but the text don't change. They change only when selected with the mouse.where am i going wrong here</p>