jQuery - AutoFill Text Box

I’m looking for a textbox Auto-fill script NOT an auto-complete script in jQuery.

Here’s is how it works:

  1. Radiobutton and textbox on the page
  2. Click the radio button
  3. Auto fill text box with radio button value

Here is a version is just JS:


<script language="JavaScript" type="text/javascript">
function autoFill(input,output){
 document.forms[0].elements[output].value=input.value;
}
</script>

Here’s the radio button onClick code:


<input type="radio" onclick="autoFill(this,'txtDoorStyle')" value="Door Half Transom (011)" name="doorstyle">

And the text box that gets autofilled:


<input type="text" value="" id="txtDoorStyle" name="txtDoorStyle" >

I need a jQuery version that can autofill multiple textboxes with the same radio button value.

I have looked all over google and all I get are AUTO-COMPLETE textbox results.

Anyone have any leads or ideas?

THANKS!!!

Here would be a jQuery version


<html>
<head>
<title>Untitled Document</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
	$('#radioid').click(function() {
  		$('#txtDoorStyle').val($(this).val());
	});
});
</script>
</head>
<body>
<input type="radio" id="radioid" value="Door Half Transom (011)" name="doorstyle">
<input type="text" value="" id="txtDoorStyle" name="txtDoorStyle" >
</body>
</html>

Jeremy, this is perfect. Thanks for your help and time!!!

No problem, glad to help!