未捕获的类型错误:使用.prepend()时,undefined不是函数
Uncaught TypeError: undefined is not a function while using .prepend()
我正试图使用jQuery .prepend()
将一个空div(<div class="myclass"></div>
)添加到另一个div容器中,但我一直遇到一个Uncaught TypeError: undefined is not a function
。以下是我到目前为止所拥有的。请对可能出了什么问题提出建议?感谢
错误消息我正在获取
TypeError: 'undefined' is not a function (evaluating '$$('#global_content').prepend($('<p>Test</p>'))')
HTML代码&JavaScript
<script type='text/javascript'>
window.addEvent('domready', function() {
$$('#global_content').prepend($('<p>Test</p>'));
});
</script>
<div id="global_content">
I want to add a div here above all other divs in this container using jQuery
<div class="myclass1"></div>
<div class="myclass2"></div>
<div class="myclass3"></div>
<div class="myclass4"></div>
</div>
这里有一个错误:
$$
在导致错误的选择器之前。
代替:
<script type='text/javascript'>
window.addEvent('domready', function() {
$$('#global_content').prepend($('<p>Test</p>'));
});
</script>
do:
<script type='text/javascript'>
window.addEvent('domready', function() {
$('#global_content').prepend($('<p>Test</p>'));
});
</script>
经过几次尝试,我终于明白了。感谢Ehsan Sajjad和你们其他人。这是我为让它发挥作用所做的。
<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript">
$.noConflict();
jQuery('#global_content').prepend('<mainbg></mainbg>');
</script>
相关文章:
- 为什么会出现错误;未捕获的类型错误:undefined不是函数;
- 为什么会出现错误,“UncaughtTypeError:undefined不是函数”
- mongoose.connect undefined不是一个函数
- Uncaught TypeError:undefined不是函数-ember js
- jQuery Mobile Undefined不是一个函数
- 未捕获的类型错误:undefined不是函数$
- 使用在函数外部声明的变量的 Javascript 返回值 + undefined
- 为什么Grunt Copy给了我一个'undefined不是函数'警告
- Bootstrap-“;未捕获的类型错误:undefined不是函数;
- Undefined不是函数ImpressPages DatePicker
- 尝试使用.ninnerHTMLlog打印数据,获取错误Uncaught TypeError:undefined不是函数
- 得到“;undefined不是函数“;错误
- Undefined不是Fullcalendar js上的函数
- 使用谷歌地图:一个返回undefined的自定义javascript函数
- jqGrid:undefined不是函数
- Jquery,Uncaught TypeError:undefined不是函数
- $http.post undefined 不是函数
- Ember cli Uncatch TypeError: undefined 不是函数
- Infragistics igGrid Uncatch TypeError: undefined 不是一个函数
- JQuery脚本在Firefox上工作;undefined不是函数“;铬