Link to home
Start Free TrialLog in
Avatar of Johnny
JohnnyFlag for United States of America

asked on

send radio text to textbox (fill in text from radiobutton)

i found this code while trying to have a radiobuttons text fill in a textbox

but i cant get it to work.

thanks in advance for any code or help you may provide

<div id="donationForm">
            <form id="formDonate" method ='request' onsubmit='return isNumeric();' action='content/creditCardAuthorize.php'>
                <fieldset id="fieldDonate">
                    <legend>Donation Form</legend> <br />
                    <p><input type='radio' id="donation" name='donation' value='10'   /> &nbsp; $10</p>
                    <p><input type='radio' id="donation" name='donation' value='20'   /> &nbsp; $20 </p>
                    <p><input type='radio' id="donation" name='donation' value='30'   /> &nbsp; $30 </p>
                    <p><input type='radio' id="donation" name='donation' value='40'   /> &nbsp; $40 </p>
                    <p><input type='radio' id="donation" name='donation' value='50'   /> &nbsp; $50 </p>
                    <p><input type='radio' id="donation" name='donation' value='75'   /> &nbsp; $75 </p>
                    <p><input type='radio' id="donation" name='donation' value='100'  /> &nbsp; $100</p>
                    <p><input type='radio' id="donation" name='donation' value=''     /> &nbsp; Other Amount </p>
                    <br />
                    <p><label for='amount'>Amount $</label> <input type='text' name='amount' id='amount' /></p>
                    <p class='submit'><input type='submit' id="donateButton" value='Continue' /></p>
                    <br />
                </fieldset>
            </form>
        </div>
        <script type="text/javascript">
                // fire our code when a radio button has been selected
                $("input:radio[@name='donation']").change(function(){
				         $("#amount, :text").val( $('input[name=donation]:checked').val());
 });
        </script>

Open in new window

Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Can you please post the rest of the script?  Thanks, ~Ray
ASKER CERTIFIED SOLUTION
Avatar of hielo
hielo
Flag of Wallis and Futuna image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Johnny

ASKER

such a moron i is i am was are.......

http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js
duh i should a caught that to add jquery to it..

thank you
Avatar of Johnny

ASKER

*smile* thank you