Can I use jQuery UI 1.12.1 with jQuery 3.x?

JqueryJquery Ui

Jquery Problem Overview


I changed my jQuery 1.7.2 to 3.1.1 and changed my jQuery UI from version 1.8.16 to version 1.12.1.

Quite a few of my existing JS stuff broke, like styling of buttons, and dialog behaves in unexpected manner, i.e. half of modal dialog is covered up by the mysterious <div class="ui-widget-overlay ui-front"></div>

I suspected jQuery UI to be at fault due to the covering above. I went to jQuery UI site and I see that stable version is for jQuery 1.7+.

Does that mean that I should be using jQuery 1.x with jQuery UI, or can I use jQuery 3.x okay (plus ... try to figure out why my styling and functionality broke)?

Jquery Solutions


Solution 1 - Jquery

jQueryUI supports the following jQuery version range:

"dependencies": {
	"jquery": ">=1.7.0 <4.0.0"
},

I'd say you're good to go.

Source: https://github.com/jquery/jquery-ui/blob/master/package.json#L49

It might be that you're seeing a lot of broken components because either you're not importing their CSS or you're overriding their CSS.

Solution 2 - Jquery

Can you use jQuery-UI with jQuery 3.2.1 ?

Imho you can not without having serious problems. See the given example below.

Assume the following configuration:

  • jQuery 3.2.1 (CDN)
  • jQuery UI 1.12.1 (CDN)
  • Detection jQ Migrate 3.0.0 for error detection.

I get the following errors:

  • jQuery.expr[":"] is now jQuery.expr.pseudos in jquery-ui.min.js
  • jQuery.expr.filters is now jQuery.expr.pseudos in query-ui.min.js
  • jQuery.unique is deprecated, use jQuery.uniqueSort

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDennisView Question on Stackoverflow
Solution 1 - JqueryjeanfrgView Answer on Stackoverflow
Solution 2 - JqueryHarmView Answer on Stackoverflow