简体   繁体   English

TypeError:未定义不是对象(正在评估“ c.trigger”)

[英]TypeError: undefined is not an object (evaluating 'c.trigger')

I have loaded the jquery-ui-1.8.7.custom.min.js file in my javascript. 我已经在JavaScript中加载了jquery-ui-1.8.7.custom.min.js文件。

But when I run my code: 但是当我运行我的代码时:

<script>
  $('.css').datepicker().datepicker(val);
</script>

I get an error like this in the console: 我在控制台中收到这样的错误:

TypeError: undefined is not an object (evaluating 'c.trigger') in jquery/jquery-ui-1.8.7.custom.min.js (line 491)

not sure, why this happening. 不知道为什么会这样。

Thanks in advance. 提前致谢。

Change it to: 更改为:

<script>
  $('.css').not('.hasDatePicker').datepicker(val);
</script>

Try making your selector more specific. 尝试使选择器更具体。 Do you want to run .datepicker() on all alements that have class css ? 是否要在所有具有css类的元素上运行.datepicker()

EDITED: 编辑:

Hey, you need to load jQuery itself not only jQuery UI! 嘿,您不仅需要加载jQuery UI,还需要加载jQuery!

Make sure to embed it: 确保嵌入它:

<script src="//code.jquery.com/jquery-latest.min.js"></script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeError: undefined is not an object(评估“this”) - TypeError: undefined is not an object (evaluating 'this') TypeError:未定义不是对象(正在评估“ table [0] [3]”) - TypeError: undefined is not an object (evaluating 'table[0][3]') TypeError:未定义不是对象(正在评估“木板”) - TypeError: undefined is not an object (evaluating 'board') TypeError: undefined is not an object(评估 XYZ) - TypeError: undefined is not an object (evaluating XYZ) TypeError: undefined is not an object(评估'object ['body']') - TypeError: undefined is not an object (evaluating 'object['body']') TypeError:undefined不是对象(评估“ this.text”) - TypeError: undefined is not an object (evaluating 'this.text') TypeError:未定义不是对象(评估“ this .__ reactAutoBindMap”) - TypeError: undefined is not an object (evaluating 'this.__reactAutoBindMap') TypeError:undefined不是对象(评估“ XYZ”)-JavaScript - TypeError: undefined is not an object (evaluating 'XYZ') - JavaScript typeError: undefined 不是一个对象(评估“item.phoneNumbers[0]”) - typeError: undefined is not an object (evaluating 'item.phoneNumbers[0]') 类型错误:未定义不是对象(评估&#39;_this3.state.bind&#39;) - TypeError: undefined is not an object (evaluating '_this3.state.bind')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM