更新时间:2021-03-15 21:54:38
引用:
<script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <script src="./Switch/Switch.js" type="text/javascript" charset="utf-8"></script>
初始化:
$('input.form_switch').Switch().addClass('class_name');
Html:
<input type="switch" data- data-left="开" data-right="关" data-checked="true" data-value="1,2" data-icon="" data-id="sw_ipt" data-name="switch" data-bg="bg_grey">
获取返回值:
$(document).on('switch:sw_sdsd1', function(e, s) { console.log('当前切换:' + s) });