function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
https://rajvakati.com/2018/05/29/using-jquery-in-lightning-components/
https://www.youtube.com/watch?v=heqsk8pZ9R8
import { LightningElement, track } from 'lwc';
import {
loadScript
} from "lightning/platformResourceLoader";
import JQuery from "@salesforce/resourceUrl/LwcScripts";
export default class BlogDemo extends LightningElement {
librariesLoaded = false;
renderedCallback() {
if (this.librariesLoaded) return;
this.librariesLoaded = true;
Promise.all([
loadScript(this, JQuery + '/LwcScripts/jquery-3.5.1.js'),
loadScript(this, JQuery + '/LwcScripts/jquery-3.5.1.min.js')])
.then(() => {
console.log("success");
})
.catch(error => {
console.log("error while loading script");
});
JQuery("document").ready(function(){
$("button").click(function(){
alert("button clicked");
})
})
}
IT GIVES ME A ERROR ON PAGE: "This page has an error. You might just need to refresh it. Error in $A.getCallback() [afterRender threw an error in 'c:blogDemo' [JQuery is not a function]] Failing descriptor: {ltng:outApp}"