转载自:http://www.jb51.net/article/113730.htm

由于项目的需求,要求radio点击两次后为取消状态,不方便修改为checkbox,可以用正面的方法实现。

// jquery
  $('input:radio').click(function(){
    //alert(this.checked);
    //
    var $radio = $(this);
    // if this was previously checked
    if ($radio.data('waschecked') == true){
      $radio.prop('checked', false);
      $radio.data('waschecked', false);
    } else {
      $radio.prop('checked', true);
      $radio.data('waschecked', true);
    }
  });

 

相关文章:

  • 2022-12-23
  • 2021-09-11
  • 2021-07-21
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-11
  • 2022-12-23
相关资源
相似解决方案