来自http://tunps.com/jstree-conflict-with-jquery-validate
I'm guessing you're using version 1.6 of the validation library, take a look at the source here: http://ajax.microsoft.com/ajax/jQuery.Validate/1.6/jQuery.Validate.js
All the way at the bottom:
$.extend($.fn, {
delegate: function(type, delegate, handler) {
return this.bind(type, function(event) {
var target = $(event.target);
if (target.is(delegate)) {
return handler.apply(target, arguments);
}
});
},
triggerEvent: function(type, target) {
return this.triggerHandler(type, [$.event.fix({ type: type, target: target })]);
}
})
The problem is that 1.6 created the $(selector).delegate() function above, which is not jQuery core .delegate(), the main issue is a naming conflict and the arguments/behavior aren't the same:
- jQuery.validate:
.delegate(type, delegate, handler) - jQuery core:
.delegate( selector, eventType, handler )
Barring other details like context, the first issue is the first and second arguments are backwards.
Including jQuery.validate 1.6 breaks the .delegate() function which jsTree relies on. If you just upgrade to version 1.7+ of the validation plugin, this issue should go away, it calls its function validateDelegate after that.
两个插件都有delegate函数,jquery.validate 1.6覆盖掉了jstree的delegate,造成冲突,1.7+以上的版本将函数名修改为validateDelegate解决了冲突。
来源:http://stackoverflow.com/questions/3079425/jstree-conflicts-with-jquery-validate