Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/07/2012, 12:16
marcwolf
 
Fecha de Ingreso: junio-2010
Mensajes: 353
Antigüedad: 14 años, 8 meses
Puntos: 6
jquery bucle de checkbox:checked para quedarme con su .val()

Hola,

Tengo este código y no sé porq no funciona . t-t

Código jquery:
Ver original
  1. $(document).ready(function(){
  2.  
  3.     $("#checkbox_comprobar").click(function() {
  4. var receive_info =[];
  5.  
  6.                   $("#checkbox").each(function() {
  7.                
  8.                 if( $("#checkbox").is(':checked')){
  9.             receive_info.push($("#checkbox").val());
  10.               alert(receive_info[0]);  
  11.              
  12.                 }
  13.                
  14.              
  15.                 });
  16.     });
  17.  
  18.  
  19.    
  20.    
  21.     $("#checkbox_activar").click(function() {
  22.         $("#checkbox").attr('checked', true);
  23.     });
  24.    
  25.     $("#checkbox_desactivar").click(function() {
  26.         $("#checkbox").attr('checked', false);
  27.     });
  28.  
  29. });

Código html.

Código HTML:
Ver original
  1. <input name="checkbox" id="checkbox" type="checkbox" value="putamadre" />
  2.         <input name="checkbox" id="checkbox" type="checkbox" value="putamadre2" />
  3.         <input name="checkbox" id="checkbox" type="checkbox" value="putamadre3" />
  4.  
  5. <input name="checkbox_comprobar" id="checkbox_comprobar" type="button" value="putamdre" />
  6.         <input name="checkbox_activar" id="checkbox_activar" type="button" value="Activar" />
  7.         <input name="checkbox_desactivar" id="checkbox_desactivar" type="button" value="Desactivar" />

gracias de antemano, disculpar el lenguaje del código esq me divierte usar tacos xd