Clicking on a disabled radio button

Stéphane Laurent

I want to disable a radio button but to be able to get the on-click event when it is disabled. Then I enclose the radio button in a div:

<div id="div_radio" display="block"><input type="radio" id="radio"/></div>

and I do, for example:

$("#div_radio").click(function(){
  $(this).hide();
});

You can try it here: http://jsfiddle.net/stla/6CKwk/2/

It works but one has to click not exactly on the radio button, and that is my problem. I have found several related questions on SO, but as a newbie in html/javascript it is possible that I have misunderstood some solutions.

A. Wolff

You could use pointer-events CSS property on modern browsers:

DEMO jsFiddle

$("#button").click(function(){
  $("#radio").prop('disabled',true).css('pointer-events','none');
});

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to make a radio button unchecked by clicking it?

Toggle HTML radio button by clicking its label

Find the closest radio button which is not disabled and checked it

clicking text should click the radio button in HTML

HTML - custom radio button not toggled if clicking the text

disabled radio button check

how to check a radio button by clicking on a table row?

Radio button not clicking on single click

How to activate a cell on clicking a radio button in Excel?

Disabled radio button in simple_form with an array

Enabling a disabled button by clicking a different button

Show multiple divs when clicking radio button

Executing radio button click upon clicking a link

How to uncheck radio button upon double clicking?

Changing text when clicking radio button

Redirecting to a struts action on clicking on a radio button

Selecting a radio button when clicking an image

selenium - clicking on radio button generated by javascript

On clicking first radio button, automatically open radio button inside of that div

Showing tooltip on disabled radio button bootstrap 3

Toggling a disabled radio button and changing checked value

Filter user details when clicking on a radio button?

VueJS: clicking disabled button still changes route

Clicking on radio button

Enable <select> <option> after clicking radio button

get the value of radio button by clicking on submit

How to select radio button by clicking its div?

Clicking radio button Selenium/Python

problem in clicking radio button can't able to select a radio button