[英]jquery.min.js Conflicts
When I add the below script ,it effecting other functionality of the project(Spring Application) 当我添加以下脚本时,它会影响项目的其他功能(Spring应用程序)
<script type="text/javascript" src="${ctx}/js/jquery-1.3.2.min.js"></script>
My Code 我的密码
<script type="text/javascript" src="${ctx}/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="${ctx}/js/easy.notification.js"></script>
<script type="text/javascript">
$.noConflict();
$(function() {
$("input[type='text']").blur(function() {
if (this.value === '') {
$.easyNotificationEmpty('Warning : You left this field empty !');
} else {
$.easyNotification('Saved Successfully !');
}
})
});
</script>
I suspect that it because of the conflict of jquery-1.3.2.min.js
我怀疑是因为
jquery-1.3.2.min.js
的冲突
I have tried $.noConflict();
我已经尝试过
$.noConflict();
, but am not getting desired results. ,但未获得理想的结果。
Please help me to resolve this problem, Thanks in advance. 请帮助我解决此问题,谢谢。
Try this, 尝试这个,
jQuery(function($) {
$("input[type='text']").blur(function() {
if (this.value === '') {
$.easyNotificationEmpty('Warning : You left this field empty !');
} else {
$.easyNotification('Saved Successfully !');
}
})
});
Use $.noConflict(); 使用$ .noConflict(); before you include new jquery plugin like below,
在您添加如下所示的新jquery插件之前,
//your old plugin here
<script type="text/javascript">
$.noConflict();
</script>
// new plugin here
//new script here
Try implementing jQuery.noConflict
on the alias you'll be using on the script that causes other scripts to break. 尝试在将导致其他脚本中断的脚本别名上实现
jQuery.noConflict
。
var someAlias = $.noConflict();
And use someAlias instead of $ on the script that causes the problem. 并在导致问题的脚本上使用someAlias而不是$ 。
You could test that and see if this makes any difference: 您可以测试一下,看看是否有任何区别:
(function ($) {
$(function() {
$("input[type='text']").blur(function() {
if (this.value === '') {
$.easyNotificationEmpty('Warning : You left this field empty !');
} else {
$.easyNotification('Saved Successfully !');
}
})
});
})(jQuery.noConflict(true))
For example: 例如:
I use with TRUE,... this work!: 我使用TRUE,...这项工作!:
//your old plugin here
<script type="text/javascript">
$.noConflict(true);
</script>
// new plugin here
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.