I am currently using jQuery 1.7.2. I have added a jQuery.UI dropdown element to my application but I am getting an error when I try to close it.
Object has no method addBack
I found the answer here: jsTree Object has no method addBack
Turns out the addBack method wasnt added until v1.8. I'm not able to update to 1.8 for a few reasons, so is it possible to add the addBack function to v1.7.2?
I think this is the correct addBack function:
addBack: function( selector ) {
return this.add( selector == null ?
this.prevObject : this.prevObject.filter(selector)
);
}
Any advice or assistance would be greatly appreciated.
add() Adds elements to the set of matched elements. addBack() Adds the previous set of elements to the current set. andSelf()
To extend jquery methods:
$.fn.addBack = function (selector) {
return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With