关于Uncaught TypeError: Cannot read property 'toLowerCase' of undefined的问题
来源:互联网 发布:access数据库怎么做 编辑:程序博客网 时间:2024/05/22 00:32
今天我在处理表单时根据触发事件动态获取input中的value值,我是直接在html代码中设置响应函数,函数中用jquery的$(this).val()获取对象的value,结果控制台报出如标题所示的错误,这我就纳了闷了,怎么会这样,甚是纠结,上网一查排在前的相关问题都是stackoverflow的,找了几个看了下,好像不是我的这种情况,然后就各种尝试….
最后突然想到会不会连input这个节点对象没获取到啊,一试还真的是,于是我就换了
html:
<script type="text/javascript">function check(){ console.log($(this)); $(this).attr("style","border:1px red solid"); console.log($(this).val()); // console.log($("input[name='example']")); //$("input[name='example']").attr("style","border:1px red solid"); // console.log($("input[name='example']").val()); }</script></head><body> <input type="text" name="example" value="0" onchange="check()"></body>
wrong:
right:
0 0
- 关于Uncaught TypeError: Cannot read property 'toLowerCase' of undefined的问题
- 关于stimusoft report 打印出现Uncaught TypeError: Cannot read property 'margins' of undefined的原因
- Uncaught TypeError: Cannot read property 'length' of undefined出现的问题
- 程序是没有问题的但是提示Uncaught TypeError: Cannot read property 'linear' 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
- 一步步写水面渲染(一)
- KETTLE系列2--创建资源库
- 常见分布式计算技术
- "#pragma CODE_SEG __NEAR_SEG NON_BANKED"这句有什么用?
- 3. 预处理(The caret package)
- 关于Uncaught TypeError: Cannot read property 'toLowerCase' of undefined的问题
- App断网提醒设计
- Hadoop学习笔记—21.Hadoop2的改进内容简介
- http://www.cnblogs.com/zhangtan/p/5846955.html
- HTML 保持Table固定高度,內空不換行設置方法
- java判断字符串是否为空的方法总结
- C大学教程C++部分23章到25章
- thinkphp中获取缓存文件的生成时间
- Supervisor 管理进程