vitalets / x-editable

In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
http://vitalets.github.io/x-editable
MIT License
6.51k stars 1.72k forks source link

Mixing Bootstrap and jQueryUI problem TypeError: this.container(...)._off is not a function #388

Open arkytn opened 10 years ago

arkytn commented 10 years ago

I'm working on a plugin for Wordpress using xeditable and ran into a problem. Since it has to work with a lot of different themes, you get lots of mixes of different javascripts. WordPress uses mostly jQuery so I wrote to the jQueryUI version of xeditable. I find that if the Theme use Bootstrap that they give the error.

TypeError: this.container(...)._off is not a function

Versions are

jQuery v1.10.2

xEditable jQueryUI v1.4.6

Bootstrap v2.3.1

I saw the previous discussion about a similar error in issue #32. but nothing there seemed to help. Any ideas?

vitalets commented 10 years ago

hi @arkytn! yes, this problem is related with simultaneous usage of jQueryUI and Bootstrap: both jquery-ui and bootstrap add $.tooltip method. When used together bootstrap overwrites it and we get error. The solutions I can suggest:

  1. try to include jQueryUI after bootstrap.
  2. Better way is to use bootstrap's noConflict method. Run this after including BS:
$.fn.bstooltip = $.fn.tooltip.noConflict();

but check that theme works well after :) If you find other solutions you're welcome to post it here.