You need to sign in to do that
Don't have an account?
Leticia Monteiro Freitas 4
jquery in lighting component
Hello,
I'm trying to pass a jquery file for an lightning component.
But I'm getting the following error:
[jQuery is not defined] - I JS didint recognize the jquery. Can anyone help me?
I'm trying to pass a jquery file for an lightning component.
<!--HTML--> <ltng:require scripts="{!$Resource.jQuery2}" afterScriptsLoaded="{!c.doInit}" />
doInit : function(component, event, helper) { jQuery("document").ready(function(){console.log('loaded');}); }
But I'm getting the following error:
[jQuery is not defined] - I JS didint recognize the jquery. Can anyone help me?
How did you create your resource jQuery2 ?
You can try an alternative:
<ltng:require scripts="{!$Resource.jQuery2 + '/jquery-3.3.1.min.js' }" />
https://rajvakati.com/2018/05/29/using-jquery-in-lightning-components/
Refer to these Links:
-->http://sfdcmonkey.com/2018/03/13/jquery-datatable-salesforce-lightning-component/
-->https://jennamolby.com/how-to-use-jquery-libraries-within-salesforce-lightning-components/
-->http://salesforcetechhub.blogspot.com/2017/01/how-to-use-jquery-in-lightning.html
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks.
Deepali Kulshrestha