Welcome! Here you can paste sources and general debugging text, You can even set yourself a password if you want to keep it just for yourself.

Posted by button on March Sun 2nd 6:30 PM - Never Expires - Views: 538

  1. <div class="btn-group" data-toggle-name="is_private" data-toggle="buttons">
  2.         <label class="btn btn-primary active">
  3.           <input type="radio" data-toggle-name="is_private" value="1dia" name="button-1dia" id="button-1dia">1 Dia</input>
  4.         </label>
  5.         <label class="btn btn-primary">
  6.           <input type="radio" data-toggle-name="is_private" value="2dias" name="button-2dias" id="button-2dias">2 Dias</input>
  7.         </label>
  8.         <label class="btn btn-primary">
  9.           <input type="radio" data-toggle-name="is_private" value="3dias" name="button-3dias" id="button-3dias">3 Dias</input>
  10.         </label>
  11.         <label class="btn btn-primary">
  12.           <input type="radio" value="7dias" name="button-7dias" id="button-7dias">7 Dias</input>
  13.         </label>
  14.         <label class="btn btn-primary">
  15.           <input type="radio" value="1mes" name="button-1mes" id="button-1mes">1 MÍs</input>
  16.         </label>
  17. </div>
  18.  
  19. <input type="hidden" name="is_private" value="1dia" />
  20.  
  21. $(function(){
  22.  
  23.   $('div.btn-group[data-toggle-name=is_private]').each(function() {
  24.     console.log("teste");
  25.     var group   = $(this);
  26.     var form    = group.parents('form').eq(0);
  27.     var name    = group.attr('data-toggle-name');
  28.     var hidden  = $('input[name="' + name + '"]', group);
  29.     $('input', group).each(function(){
  30.       console.log("teste2");
  31.       var button = $(this);
  32.       button.on('click', function(){
  33.         console.log("teste3");
  34.         hidden.val($(this).val());
  35.       });
  36.       if(button.val() == hidden.val()) {
  37.         button.addClass('active');
  38.       }
  39.     });
  40.   });
  41.  
  42.  
  43. });
Language:
To highlight particular lines, prefix each line with @@




© 2017  YSblue.com.br (Implemented and Adapted) - Powered by PASTE 1.0