jquery.min.js冲突
当我添加以下脚本时,它会影响项目的其他function(Spring Application)
我的代码
$.noConflict(); $(function() { $("input[type='text']").blur(function() { if (this.value === '') { $.easyNotificationEmpty('Warning : You left this field empty !'); } else { $.easyNotification('Saved Successfully !'); } }) });
我怀疑它是因为jquery-1.3.2.min.js
的冲突
我试过$.noConflict();
,但没有得到理想的结果。
请帮我解决这个问题,提前谢谢。
试试这个,
jQuery(function($) { $("input[type='text']").blur(function() { if (this.value === '') { $.easyNotificationEmpty('Warning : You left this field empty !'); } else { $.easyNotification('Saved Successfully !'); } }) });
使用$ .noConflict(); 在包含如下所示的新jquery插件之前,
//your old plugin here // new plugin here //new script here
尝试在将要导致其他脚本中断的脚本上使用的别名上实现jQuery.noConflict
。
var someAlias = $.noConflict();
并在导致问题的脚本上使用someAlias而不是$ 。
你可以测试一下,看看这是否有所不同:
(function ($) { $(function() { $("input[type='text']").blur(function() { if (this.value === '') { $.easyNotificationEmpty('Warning : You left this field empty !'); } else { $.easyNotification('Saved Successfully !'); } }) }); })(jQuery.noConflict(true))
例如:
我使用TRUE,……这项工作!:
//your old plugin here // new plugin here