Alex Pho Alex Pho - 1 year ago 119
jQuery Question

Show modal on click from radio button input

I have two radio buttons. Yes and No. For yes, on click it will show a download button underneath which works fine with the current HTML and Javascript. Now when you select the "No" radio button, I want it to display a modal with information. I already have the modal implemented and working as a separate button, but I haven't found any solutions to show the modal upon radio button input for no.

Here is the current Javascript that I have for show/hide from radio button input for divs.

var radio_value = $(this).val();
if(radio_value=='0') {
else if(radio_value=='1') {


Answer Source

You should use $('#myModal').modal('show'); if the input no is checked

$('input[name="bn"]').change(function() {
   if($(this).is(':checked') && $(this).val() == '0') {


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download