
rescate valor radiobutton
Publicado por Victor (11 intervenciones) el 18/02/2016 13:18:21
Tengo 3 radio que al clickear una se habilita cierta opcion, el problema que solo me toma el valor del primer radio y cuando presiono cualquiera de los otros 2 no me toma el valor, le puse un alert para ver y justamente solo me toma el primer valor.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<table>
<tr align="center" class="letraChica" >
<td>
<input class="" value="1" type="radio" name="obras" id="obras" />
<label for="obras">INSTALACIÓN DE FAENAS</label>
</td>
<td>
<input class="" value="2" type="radio" name="obras" id="obras" />
<label for="obras">INSTALACIÓN DE GRUA</label>
</td>
<td>
<input class="" value="3" type="radio" name="obras" id="obras" />
<label for="obras">EJECUCIÓN EXCAVACIONES, ENTIBACIONES Y SOCALZADO</label>
</td>
</tr>
</table>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$('#obras').on('click', function () {
if ($('#obras').val()==1) {
//('input:radio[name=edad]:checked').val()
alert($('#obras').val());
$("#faenas").attr('style', 'display: block;');
$("#grua").attr('style', 'display: none;');
$("#excavaciones").attr('style', 'display: none;');
}else{
$("#faenas").attr('style', 'display: none;');
}
if ($('#obras').val()==2) {
alert($('#obras').val());
$("#faenas").attr('style', 'display: none;');
$("#grua").attr('style', 'display: block;');
$("#excavaciones").attr('style', 'display: none;');
}else{
$("#grua").attr('style', 'display: none;');
}
if ($('#obras').val()==3) {
alert($('#obras').val());
$(this).val()
$("#faenas").attr('style', 'display: none;');
$("#grua").attr('style', 'display: none;');
$("#excavaciones").attr('style', 'display: block;');
}else{
$("#excavaciones").attr('style', 'display: none;');
}
});
Valora esta pregunta


0