js Cannot set property 'color' of undefined
来源:互联网 发布:软件视频会议排名 编辑:程序博客网 时间:2024/05/22 14:59
js 动态加载td :$('#thead').after("<tr><td id='code"+nCode+"' style='cursor:pointer;color:black;' onclick='crawlTempleTest("+nCode+","+tplGrade+");'>"+nCode+"</td></tr>");
获取tdstyle:
var templetList = $('#code'+nCode);
// $('#code'+nCode).style.color="green";
if(templetList.style.color=="red"){
templetList.style.color="green";
}else{
templetList.style.color="red";
}
报错:Cannot read property 'color' of undefined
解决:jQuery对象没有style属性,样式通过css设置
var templetList = $('#code'+nCode);
var color = templetList.css("color");
if('rgb(0, 0, 0)'==color){
templetList.css("color","RoyalBlue");
}else{
templetList.css("color","black");
}
阅读全文
0 0
- js Cannot set property 'color' of undefined
- Ueditor Cannot set property 'innerHTML' of undefined
- TypeError: Cannot set property 'user' of undefined
- Cannot set property 'value' of undefined
- jquery.mobile-1.4.5.min.js:3 Uncaught TypeError: Cannot set property 'mobile' of undefined
- Cannot set property 'display' of undefined【利用Chrome浏览器查看js语法错误】
- node.js开发错误——TypeError: Cannot set property 'XXX' of undefined
- UEditor使用报错Cannot set property 'innerHTML' of undefined
- Uncaught TypeError: Cannot set property 'applyDefaults' of undefined
- Uncaught TypeError: Cannot set property 'mobile' of undefined
- Hexo: TypeError: Cannot set property 'lastIndex' of undefined
- UEditor使用及Cannot set property 'innerHTML' of undefined 及Cannot read property 'replace' of undefine
- JS: Cannot read property 'innerHTML' of undefined错误
- 关于js页面:cannot read property 'call' of undefined
- Cannot read property 'name' of undefined @ injectScripts.min.js:1
- background.js Uncaught TypeError: Cannot read property 'xxx' of undefined
- TS/JS错误:TypeError: Cannot read property 'prototype' of undefined
- vue.js中报错: TypeError: Cannot read property 'indexOf' of undefined
- Android Studio类中实现Serializable自动生成serialVersionUID
- Android-N app seinfo设置流程
- 表驱动初步接触之Map代替if/switch
- 比特币交易(Transaction)的输入与输出
- 面试题10—二进制中1的个数
- js Cannot set property 'color' of undefined
- Websphere安装、企业部署应用举例
- Codeforces Round #420 (Div. 2) C. Okabe and Boxes
- 高效能人士的七个习惯——习惯二以终为始
- C# SQLite通用读写操作方法
- csrf
- 浅谈mvp架构模式
- Codeforces 821D Okabe and City【思维建图+Dij+优先队列优化】好题~好题~
- POJ 1064 Cable master【二分】