Radio box, get the checked value [iCheck]

后端 未结 4 478
我在风中等你
我在风中等你 2021-01-11 14:53

Basic radio box

  • Te
  • 相关标签:
    4条回答
    • 2021-01-11 15:14

      Attach a handler to ifChanged event:

      $('input').on('ifChecked', function(event){
        alert($(this).val()); // alert value
      });
      

      There are 11 ways to listen for changes:

      • ifClicked - user clicked on a customized input or an assigned label
      • ifChanged - input's checked, disabled or indeterminate state is changed
      • ifChecked - input's state is changed to checked
      • ifUnchecked - checked state is removed
      • ifToggled - input's checked state is changed
      • ifDisabled -input's state is changed to disabled
      • ifEnabled - disabled state is removed
      • ifIndeterminate - input's state is changed to indeterminate
      • ifDeterminate - indeterminate state is removed
      • ifCreatedinput - is just customized
      • ifDestroyed - customization is just removed

      JSFIDDLE

      0 讨论(0)
    • 2021-01-11 15:15

      Avoid using jquery as much as you can. You can also use code below;

      $('input').on('ifChecked', function(event){
          alert(event.target.value); // alert value
      });
      
      0 讨论(0)
    • 2021-01-11 15:20
      $('body').on('ifChecked','.icheck', function(){
      //considering icheck is the class of your checkbox and it is getting generated dynamically
      });
      
      0 讨论(0)
    • 2021-01-11 15:22

      Use this

      // Check #x
      $( "#x" ).prop( "checked", true );
       
      // Uncheck #x
      $( "#x" ).prop( "checked", false );

      0 讨论(0)
    提交回复
    热议问题