Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2004
    Posts
    96
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Possible to use Jquery for radio buttons and submit?

    Hi,

    I have 3 radio buttons with the same name ("myradio"). The value of each is a different URL (eg. value="http://www.google.com")

    I have a link underneath these (<a href="#">Send</a>). I would like the selected radio button's value to be inserted into the href of the link, and if the user selects a different radio button that this changes.

    Is there any way of doing this using Jquery?

    Thanks in advance

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    It's easier to to if you give your anchor tag an ID:
    <a id="my_anchor_tag_id" href="#">Send</a>

    Code:
    $('input[name=myradio]').click(function(){
    $('#my_anchor_tag_id').attr('href', $(this).val());
    });


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •