0

I am looking for someone who has used jQuery in the capacity of assigning a value to a text area when the user clicks a radio button.
Here is the example code I have worked on so far that does not work.

<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(@name='donation']").change(function(){
                   $('#amount').val(value) = $("input[@name='donation']").val()
                });
        </script>

Thanks!
WBR

2
Contributors
2
Replies
7
Views
7 Years
Discussion Span
Last Post by alexbestoloci
1

Well after hours of work I found this to work:

$("input:radio[@name='donation']").change(function(){
         $("#amount, :text").val( $('input[name=donation]:checked').val());
 });

Edited by rouse: n/a

0

thanks! it works for me

<span class="star-cb-group">
      <input type="radio" id="rating-5" name="rating" value="5" /><label for="rating-5"></label>
      <input type="radio" id="rating-4" name="rating" value="4" /><label for="rating-4"></label>
      <input type="radio" id="rating-3" name="rating" value="3" /><label for="rating-3"></label>
      <input type="radio" id="rating-2" name="rating" value="2" /><label for="rating-2"></label>
      <input type="radio" id="rating-1" name="rating" value="1" /><label for="rating-1"></label>
      <input type="radio" id="rating-0" name="rating" value="0" class="star-cb-clear" /><label for="rating-0"></label>
</span>



<script type="text/javascript">
$('.star-cb-group [type*="radio"]').change(function(){
         $('#result').val( $('.star-cb-group [type*="radio"]:checked').val());
 });
</script>



<input name="result" id="result" type="text" />
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.