John S John S - 2 months ago 24
jQuery Question

Zurb Foundation 5 and Jquery 3 incompatible?

I am trying to use Zurb Foundation 5 with JQuery 3.0.0.1 and seem to be having some compatibility issues. When I initialize Foundation

$(document).foundation();
a javascript error is thrown


Object doesn't support property or method 'indexOf' on line 9612


If I roll back to 2.2.4 everything works fine.
Has anyone else run into this?

Browser: MS Edge(IE 11)

Answer

Yes, Zurb Foundation 5 and jQuery 3 are incompatible. Foundation still uses the load function, which was deprecated 4 years ago in jQuery 1.8 and finally removed in jQuery 3.0. Since there is another jQuery Function called load, which is called instead, you get this rather cryptic error message.

Even the current relased Version of Zurb Foundation 6.2.3 and jQuery 3 are incompatible. The fix for your problem is already merged and should be released with version 6.2.4 which was to be released about 2 months ago, but still isn't. (Its 78% complete according to the GitHub page)

So I guess the only solution is to a) ignore the error or b) patch the code yourself as described in this answer.

Update: Foundation 6.2.4 was apparently postproned to October 27, 2016, so this is when Foundation will hopefully support jQuery 3.