views:

46

answers:

1

Is there a way to create a dynamic href using radio buttons?

radio = value1
radio = value2
radio = value3

<a href="test.php?value=radio">
A: 

I wonder what are you trying to do, however you can:

$(function(){
  $('input[type="radio"]').click(function(){
    if ($(this).is(':checked'))
    {
       $('a').attr('href', 'test.php?value' + $(this).val()).text($(this).val()).appendTo($('body'));
    }
  });
});
Sarfraz
Thanks a lot^^Is it also possible with radio button and checkbox combined?
Xin
@Xin: You are welcome, yes you can do with checkboxes too, just change the radio name at line $('input[type="radio"]') with checkbox.
Sarfraz
i see, thnx a lot =D
Xin