0
I have this form with these inputs, I want to get the value that is inside the radio button input selected, example as in the image, I should get "bb".
My html:
<label>Respostas:</label>
<div class="input-group">
<span class="input-group-addon">
<input type="radio" name="respostacorreta">
</span>
<input type="text" class="form-control" id="pergunta1">
</div><!-- /input-group -->
<div class="input-group">
<span class="input-group-addon">
<input type="radio" name="respostacorreta">
</span>
<input type="text" class="form-control" id="pergunta2" >
</div><!-- /input-group -->
<div class="input-group">
<span class="input-group-addon">
<input type="radio" name="respostacorreta" >
</span>
<input type="text" class="form-control" id="pergunta3">
</div><!-- /input-group -->
My jquery so far, I’m only getting the text of all fields:
<script>
$(document).ready(function(){
$('#btnenviarnoticia').click(function() {
var btn = $(this);
btn.button('loading');
var respostas = [$('#pergunta1').val(),$('#pergunta2').val(),$('#pergunta3').val()];
alert(respostas);
});
});
</script>
It worked, thank you
– Igor Oliveira