I need to get the value of input
radius inside a modal bootstrap
, but it does not render the value looks like this:
Iusedthisexampleofradios:
<divid="itemList">
<input type="radio" value ="1" class="overWrite" name="overWrite" />Yes
<input type="radio" value ="2" class="overWrite" name="overWrite" />No
</div>
In the debug, I noticed that when I get the value soon to load the page this way:
$(document).ready(function(){
var overwrite = $('#itemList input:radio:checked').val();
alert('value = ' + overwrite);
});
It can capture the value of the input, however when I get it through the change or click it it returns empty:
$("input[type='radio']").click(function () {
var radioValue = $(this).val();
alert(radioValue);
});
When the modal is loaded on the page the radio input loses its value, in the same form there are other inputs, but this happens only with the radio button. Does anyone know why?