bug宝典之bootstrap switch Uncaught TypeError: Cannot read property 'apply' of undefined
来源:互联网 发布:批量查询淘宝小号 编辑:程序博客网 时间:2024/05/22 11:46
我使用下面的js,对bootstrap switch进行赋值的时候,提示错误 Uncaught TypeError: Cannot read property 'apply' of undefined
var isUp = $('#isUp').data('value'); console.log('isUp is ' + isUp); if (isUp==undefined || isUp == ''){ $('#isUp').bootstrapSwitch('setState',true); } else{ $('#isUp').bootstrapSwitch('setState',isUp); }
详细错误信息如下图所示:
我参考这个设置 使用jQuery获取Bootstrap Switch的值
看来有问题,于是查看源码,根本没有setState方法,应该使用下面的方法:
$('#isUp').bootstrapSwitch('state',$('#isUp').data('value'));
0 0
- bug宝典之bootstrap switch Uncaught TypeError: Cannot read property 'apply' of undefined
- Datatables 之Uncaught TypeError: Cannot read property 'mData' of undefined
- Extjs4---Uncaught TypeError: Cannot read property ‘items’ of undefined
- 【StackFlow】Uncaught TypeError: Cannot read property 'pageCount' of undefined
- Ckeditor: Uncaught TypeError: Cannot read property 'keyCode' of undefined 解决方法
- Uncaught TypeError: Cannot read property 'msie' of undefined问题解决方案
- Uncaught TypeError: Cannot read property 'options' of undefined 错误
- Uncaught TypeError: Cannot read property 'length' of undefined
- 错误:Uncaught TypeError: Cannot read property 'WebSocket' of undefined
- Uncaught TypeError: Cannot read property 'value' of undefined
- Uncaught TypeError: Cannot read property 'plugin' of undefined
- react Uncaught TypeError: Cannot read property 'title' of undefined
- Uncaught TypeError: Cannot read property 'width' of undefined
- Uncaught TypeError: Cannot read property 'substring' of undefined
- Uncaught TypeError: Cannot read property 'PRINT_INIT' of undefined user:100
- Uncaught TypeError: Cannot read property 'substring' of undefined
- extjs4:Uncaught TypeError: Cannot read property 'processed' of undefined
- background.js Uncaught TypeError: Cannot read property 'xxx' of undefined
- javaSE的一些常用类
- CCS 的链接器选项
- opencv -GUI接口介绍
- 字符串操作函数(使用,没有自己定义)
- Install Windows 10/7 without USB or DVD from Linux
- bug宝典之bootstrap switch Uncaught TypeError: Cannot read property 'apply' of undefined
- Android自定义View之刻度尺滑动功能(一)
- Android中第五大组件详解
- ArcGIS数据统计及字段计算
- IOS、swift学习笔记心得之初入mac,xcode,swift
- C语言写的链表
- 在Web.xml中自动扫描Spring的配置文件及resource时classpath*:与classpath:的区别
- linux下文件的三个时间
- 利用PHP来进行消息推送