How to check a radio button when clicking on text input

How to check a radio button when clicking on text input

Hi,

This seems like such an easy thing to do but I can't figure it out. I've got a form with inputs like these:

<label for="productA_0"><input type="radio" name="productA" value="1" id="productA_0" checked="checked">1</label>
<label for="productA_1"><input type="radio" name="productA" value="2" id="productA_1">2</label><input name="priceA" type="text" value="" class="textinput">
<label for="productA_2"><input type="radio" name="productA" value="3" id="productA_2">3</label>


So three radio buttons and one has a text input next to it. All I want is for the radio button (2) to be checked when the user clicks (or changes) the text input. This is one of the many combinations I've tried that doesn't work:

$(function() {
$(".textinput").click(function () {   
  $(this).prev("input[type=radio]")[1].checked = true;
});
});


Can someone point me in the right direction please? I always seem to struggle with selecting elements...

Thanks,