当我使用时,没有定义jQuery
jquery is not defined when i m using
我收到错误jquery未定义..请帮助我..
jQuery(function(){
jQuery('#submitid').click(function(){
if(jQuery('input[id="EnrollmentServiceAddress1"]').val() != ''){
var add2 = jQuery('input[id="EnrollmentServiceAddress2"]').val();
if(add2.indexOf('#', 0) && add2 != ''){
jQuery('input[id="EnrollmentServiceAddress2"]').val('#'+add2);
}
}
QadServer.current.submit("#EnrollmentServiceInformationForm");
});
jQuery('input[name="residence_type"]').click(function() {
if(jQuery('input[name="residence_type"]:checked').val() == 'home') {
// jQuery('#add_type').html('Home Number');
jQuery('#home_apt').slideUp('slow');
} else if(jQuery('input[name="residence_type"]:checked').val() == 'apartment') {
jQuery('#add_type').html('Apartment Number');
jQuery('#home_apt').slideDown('slow');
}
});
jQuery('.qad_suggestion').live('click',function() {
qad_test();
});
jQuery('div[id="change_add"] > span').click(function() {
jQuery('input[id="EnrollmentServiceAddress1"]').val('');
jQuery('input[name="residence_type"]:checked').attr('checked', false);
jQuery('#home_apt').hide();
jQuery('#change_add').slideUp('slow', function() {
jQuery('#validate_add_block').slideDown('slow');
});
});
<?php if($this->Session->check('Enrollment.social_security_number')) { ?>
// jQuery('#validate_add_block').hide(); //Old code
// jQuery('#change_add').show();
jQuery('#validate_add_block').show(); //New code
jQuery('#change_add').hide();
<?php } ?>
init();
});
Erro 是因为 jquery 文件未正确加载以避免这种情况 尝试以下代码,如果它未包含在您的页面中,请包含 jquery ...
<script type="text/javascript">
/******** Load jQuery if not present *********/
if (typeof jQuery === "undefined" || jQuery.fn.jquery !== '1.4.2')
{
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js")
document.getElementsByTagName("head")[0].appendChild(script_tag);
}
}
$(document).ready(function() {
alert('jQuery Library Loaded');
});
</script>
尝试
jQuery.noConflict()
否则尝试替换$ with jQuery
.
把这一行放在jquery代码的顶部
jQuery.noConflict();
你包括jQuery了吗?
<script type="text/javascript" src="jquery.js"></script>
或
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery
在你的视图文件中
试试这个 <?php $this->Js->JqueryEngine->jQueryObject = 'jQuery'; ?>
相关文章:
- 如何在WordPress的头中加载自定义jQuery
- 自定义jQuery脚本无法在Wordpress上运行
- 自定义Jquery css下拉菜单问题
- 自定义jquery选择器属性未在模拟器中激发
- 通过Rails中的自定义Jquery对话框处理链接的确认
- 自定义jquery验证器
- jQuery DataTable 插件:我想自定义 jQuery DataTable
- 将动态验证文本添加到自定义jQuery验证规则中
- 如何自定义 jQuery 密码强度指示器位置
- ASP.NET MVC - 未捕获的引用错误:即使我包含库,也不会定义jQuery
- 未定义 JQuery 函数
- 构建自定义jQuery选择
- 在速度方面,使用变量而不是重新定义jquery对象更好吗
- JavaScript运行时错误,未定义jQuery
- 自定义JQUERY未在分页页面上加载(第一页除外)
- 自定义jQuery插件:事件未按预期运行
- 自定义jquery AJAX方法
- '$'未定义Jquery ajax请求-javascript导入
- 找不到自定义jQuery插件
- 了解自定义JQuery事件以及如何轻松修改它