Submit form with event when checking radio buton bootflap

Asked

Viewed 34 times

1

I am using this Responsive HTML library (http://bootflat.github.io/documentation.html) and I want to submit a form when I click on a radio button. The problem is that as there are multiple "layers" of Divs above the radio button, it is not checked directly, and so the Submit event does not occur.

How can I fix this?

Code

Before you click the browser:

<div style="position: relative;" class="iradio_flat">
<input type="radio" name="diploma" id="diploma" value="DS" onchange='this.form.submit();'>
</div>
<label id="diploma_DS" class="radio_label" for="diploma">Diploma</label>

After clicking on the browser:

<div style="position: relative;" class="iradio_flat">
    <div class="iradio_flat checked" style="position: relative;">
        <input name="diploma" id="diploma" value="DS" checked="" onchange="this.form.submit();" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0% 0%; border: 0px none; opacity: 0;" type="radio">
        <ins class="iCheck-helper" style="position: absolute; top: -20%; left: -20%; display: block; width: 140%; height: 140%; margin: 0px; padding: 0px; background: rgb(255, 255, 255) none repeat scroll 0% 0%; border: 0px none; opacity: 0;"></ins>
    </div>
</div>
<label id="diploma_DS" class="radio_label" for="diploma">Diploma</label>

1 answer

0

If your radio button is "overwritten" after the page has finished loading and you want it to be so, or there is no easy change, assign the click event to the element that is "above" of your radio button.

To check this press the right button on it and go to the "inspect element" option of your browser and find exactly the selector that should assign the click event.

Assign an id in your form and modify the example below for your reality:

$(function() {
    $('#div_que_esta_por_cima').click(function() {
        $('#id_do_formulario').submit();
    });
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.