Ver Mensaje Individual
  #8 (permalink)  
Antiguo 22/08/2012, 14:39
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 13 años, 8 meses
Puntos: 6
Respuesta: cambiar el valor de un input mediante javascript

amigos lo solucione , pero si alguien me colabora mejorando el codigo bienvenido sea

Código Javascript:
Ver original
  1. $(document).ready(function(){
  2.     $('.input_control').change(function(){
  3.     var checkeado = $(this).attr("checked");
  4.     if(checkeado) {
  5.         //alert('activado');
  6.         $('input[name='+ $(this).attr('value')+']').attr('value', 1);
  7.     } else {
  8.         //alert('desactivado');
  9.         $('input[name='+ $(this).attr('value')+']').attr('value', 0);
  10.     }
  11. });
  12.        
  13.        $(".check_todos").click(function(event){
  14.          if($(this).is(":checked")) {
  15.             $(".input_control:checkbox:not(:checked)").attr("checked", "checked");
  16.             $(".q").attr('value', 1);
  17.          }else{
  18.              $(".input_control:checkbox:checked").removeAttr("checked");
  19.              $(".q").attr('value', 0);
  20.          }
  21.        });
  22.  
  23.        
  24.     });