views:

86

answers:

1

I have two radio buttons, one and two,

if i click the radio button two, the warning message should appear and the button should be reset to one

can you suggest some code for this

+1  A: 

First of all if you don't want the second radio button to be checked then why do you use it.

$(".selector_for_first_radio").attr("checked", true);

will be enough to check the first radio button.

$(document).ready ( function () {
    $("#rd1").click ( function ()
    {
        alert ( "You can't do this" );
        $("#rd2").attr ( "checked" , true );
    });
});

<input type="radio" id="rd1" />
<input type="radio" id="rd2" />
rahul
i have set second radio button for future use
Senthil Kumar Bhaskaran