-1
I need to get the value of input
radio inside a modal bootstrap
, but it does not render the value stays that way:
I used this example of radios:
<div id="itemList">
<input type="radio" value ="1" class="overWrite" name="overWrite" />Yes
<input type="radio" value ="2" class="overWrite" name="overWrite" />No
</div>
In debug, I realized that when I get the value right by loading 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, but when caught through change or click 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?
Probably this 'value' is being set dynamically to empty, so when you just load the document it is there and when you pull the 'click' it is no longer there.
– Jhonny Mesquita