[SalesForce] Attaching jQuery library in lightining component causing an error on Summer 16

I'm using jquery as static resource.

<ltng:require scripts="/resource/jquery/jquery-2.2.4.min.js" />

In firefox it throws an error:

TypeError: fn is undefined throws at
https://light-demo-dev-ed.lightning.force.com/auraFW/javascript/XyhLNaMJXc3t5qwu_xzuTA/aura_proddebug.js:14073:9

I've also tried older version of jQuery 1.12.4
Result is the same. Also error thrown in chrome:

Uncaught TypeError: Cannot read property 'expando' of undefined throws at /resource/jquery1/jquery-1.12.4.min.js:5:8159

Also attempted to add lates jQuery version 3.0.0
In Firefox it throws error:

TypeError: d.implementation is undefined throws at https://light-demo-dev-ed.lightning.force.com/c/demo_app_development.app:6:18148

In Chrome:

Uncaught TypeError: Cannot read property 'createHTMLDocument' of undefined throws at /resource/jquery3/jquery-3.0.0.min.js:6:18166

Best Answer

After summer 16 release, we need to change the code to include the external JQuery/Css files from static resource. Here is an example of the same:

<ltng:require .... scripts="{!$Resource.JQuery}" />

Here JQuery is the static resource name, and this static resource is having only single JS File.

For a zip file having multiple files/folder follow another syntax:

<ltng:require ....  scripts="{!join(',', 
    $Resource.jsLibraries + '/jsLibOne.js', 
    $Resource.jsLibraries + '/jsLibTwo.js')}" />

More details you can find in following salesforce doc: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/js_libs_platform.htm