![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
15/03/2012, 07:41
|
| | Fecha de Ingreso: septiembre-2010
Mensajes: 74
Antigüedad: 14 años, 4 meses Puntos: 1 | |
Respuesta: quiero habilitar textbox al tildar checkbox Cita:
Iniciado por h2swider aquí tienes algo que te podría servir. Rehice todo tu codigo, espero que sepas agradecerlo.
Saludos
Código PHP:
Ver original<?php include_once 'lib.php'; $result = mysql_query("SELECT id_stock, codigo, descrip, pre_min, pre_may, disponibles FROM stock where activo = '1'", $conexion); ?> <form name="borrar" method="post" action="vender_prod.php"> <table border="2"> <tr> <th>ID</th> <th>Codigo</th> <th>Descrip</th> <th>Prec.Min</th> <th>Prec.May</th> <th>Disponibles</th> <th></th> <th style='border: none'></th> <th>Cantidad</th> </tr> <?php $i = 0; ?> <tr> <td><?php echo $row['id_stock'] ?></td> <td><?php echo $row['codigo'] ?></td> <td><?php echo $row['descrip'] ?></td> <td align="right"><?php echo $row['pre_min'] ?></td> <td align="right"><?php echo $row['pre_may'] ?></td> <td align="center"><?php echo $row['disponibles'] ?></td> <td><input id="chk_<?php echo $i ?>" name="seleccion[]" type="checkbox" value="<?php echo$row['id_stock'] ?>" class="chk"/></td> <td style="border: none"></td> <td><input id=txt_<?php echo $i ?>" name="text[<?php $row['id_stock'] ?>]" disabled="disabled" type="text" style="width: 60" class="txt"/></td> </tr> <?php $i++; } ?> </table> <br /> <input type="submit" name="submit" value="enviar"> </form> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $(".chk").change(function(){ var comentario = $( '.txt', $( this ).parents ( 'tr' ) ); if( $(this).is(':checked')){ comentario.removeAttr('disabled'); } else { comentario.attr('disabled', true); } }); }); </script>
Anduvo impresionante, nunca nadie me dio una mano tan grande. GRACIAS h2swider, SOS LO MAXIMO!! |