How can i prevent a radio button on 2nd click

I have a radio button, while clicking on it its slides a form, again if I clicked on that no action shouldn’t be taken place because radio buttons are not toggle case. how can I do this.

Html:

   <div >
   <input type="radio" id="shippingform" name="shippingform">
 <label for="shippingform">SHIPPING HOME</label>
 <span id="shipping_radio_chk" class="check"></span>
</div>

JS:

$("#ShippingAddress_Form").hide();
$("#shippingform").on('click', function(){
	$("#ShippingAddress_Form").show();
	$("this").attr("disabled","disabled");

delete the radio button if it was clicked. in which case you could also use a button.

@Dormilich: Th radio button should be shown with checked while selecting.

and after selecting?

If I selected radio button it should show a div after that radio button should not be clickable.

if the radio button has no further use, you can delete it.

It’s $(this), not $("this").

Entirely removing an element from the DOM only because you currently don’t need it seems a bit over the top to me TBH. ^^

Are you just wanting to prevent your on click event from happening a second time?

You can turn off that click event which will stop it from happening again.

$("#shippingform").on('click', function(){
    $("#ShippingAddress_Form").show();
    $("#shippingform").off('click');
});

@Paul_Wilkins: Thank you, It’s working… :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.