Working with radio buttons
within a modal
problem arose for me, since by means of the selection of said input radio
a paypal form is filled out.
That is, there are 4 radio buttons
and each one has a value
different one.
<input type="radio" id="id-5" class="o_input" name="paquetes" value="5">
<input type="radio" id="id-20" class="o_input" name="paquetes" value="20">
<input type="radio" id="id-50" class="o_input" name="paquetes" value="50">
<input type="radio" id="id-100" class="o_input" name="paquetes" value="100">
But, these are inside a modal and basically what I am trying to do is that when selecting one of them radio buttons
I pass the value of the value to a field of a form (paypal). There is the inconvenience, I know how to assign the values but this time it does not work.
<input type="hidden" name="quantity" id="quantity" value="10">
And try it like this:
$('input.paquetes').click(function(){
$('#quantity').val($(this).val());
});
/******************************************/
$('input[type=radio]').on('change', function() {
$('#quantity').val($(this).val());
});
/******************************************/
$('input[type=radio]').on('click', function() {
$('#quantity').val($(this).val());
});
Also directly by the attribute id
, clase
, using click
, using change
, using on()
, etc. Even so, I can't even get it to enter the event and JQuery
it's working perfectly because the rest of the site works with it and it doesn't have any problems.
He modal
is like this:
<div class="modal slideInUp fade text-left animated" id="tokens" tabindex="-1" role="dialog" aria-labelledby="title" aria-hidden="true"></div>
Inside it has the radio buttons
and the form
of paypal
.
In
JQuery
the elements insidemodal
you identify them like this:So I suggest you try the following:
Here I leave you a Code Snipet using radios in a bootstrap modal