Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/09/2016, 05:44
Avatar de Rafael
Rafael
Modegráfico
 
Fecha de Ingreso: marzo-2003
Mensajes: 9.028
Antigüedad: 21 años, 2 meses
Puntos: 1826
Script no funciona localmente pero sí en jsfiddle

Ok Estoy tonto o algo así.

Usando una respuesta de este post:

http://stackoverflow.com/questions/4...utton-on-click

Está esta opción http://jsfiddle.net/1bfsnzn9/

Sí funciona ahí, pero al ponerlo en un archivo html no funciona...

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <meta charset="utf-8" />
  3. <script src="https://code.jquery.com/jquery-2.2.4.js"></script>
  4.    
  5. $('input[type=radio]').on('mousedown', function(e){
  6.     var wasChecked = $(this).prop('checked');
  7.     this.turnOff = wasChecked;
  8.     $(this).prop('checked', !wasChecked);
  9. });
  10.  
  11. $('input[type=radio]').on('click', function(e){
  12.     $(this).prop('checked', !this.turnOff);
  13.     this['turning-off'] = !this.turnOff;
  14. });
  15.  
  16. </head>
  17.  
  18.     <input type="radio" id="Uno" name="Opciones" /><label for="Uno">Texto</label>
  19.     <input type="radio" id="Dos" name="Opciones" /><label for="Dos">Texto</label>
  20.  
  21. </body>
  22. </html>

¿Alguna idea?