我不知道你怎么写的开关,我fastadmin从别处复制了一个开关,写了一段JS监听开关

这是开关代码

<input  >
<a href="javascript:;" data-toggle="switcher" class="btn-switcher a-switch" data-input- >
                <i class="fa fa-toggle-on text-success {eq name="$row.switch" value="0"}fa-flip-horizontal text-gray{/eq} fa-2x"></i>
</a>

这是监听的JS,我为了方便引用了JQ,你可以写原生js

<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
    $('.a-switch').click(function () {
        var val = $('#a-switch').val();
        if(val == 0){
            // 此处写给你想控制的元素加上 disabled
            console.log(val);
        }else{
            // 此处写给你想控制的元素去掉 disabled
            console.log(val);
        }
    })
</script>

相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2021-12-14
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2021-08-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-05-27
  • 2022-12-23
相关资源
相似解决方案