Reputation: 3062
When I add the below script ,it effecting other functionality of the project(Spring Application)
<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
I have tried $.noConflict();
, but am not getting desired results.
Please help me to resolve this problem, Thanks in advance.
Upvotes: 1
Views: 5451
Reputation: 1
I use with TRUE,... this work!:
//your old plugin here
<script type="text/javascript">
$.noConflict(true);
</script>
// new plugin here
Upvotes: 0
Reputation:
Try implementing jQuery.noConflict
on the alias you'll be using on the script that causes other scripts to break.
var someAlias = $.noConflict();
And use someAlias instead of $ on the script that causes the problem.
Upvotes: 2
Reputation: 24312
Try this,
jQuery(function($) {
$("input[type='text']").blur(function() {
if (this.value === '') {
$.easyNotificationEmpty('Warning : You left this field empty !');
} else {
$.easyNotification('Saved Successfully !');
}
})
});
Upvotes: 8
Reputation: 31
Use $.noConflict(); before you include new jquery plugin like below,
//your old plugin here
<script type="text/javascript">
$.noConflict();
</script>
// new plugin here
//new script here
Upvotes: 3
Reputation: 74420
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:
Upvotes: 1