function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Megha SachaniaMegha Sachania 

How could i use jquery in lightning web component? please let me know if anyone have idea

David Zhu 🔥David Zhu 🔥
This blog explains how to use jquery in lighting component. It might help you.
https://rajvakati.com/2018/05/29/using-jquery-in-lightning-components/
DipthiDipthi
This Youtube video shows very clearly with an example. Hope this would help.
https://www.youtube.com/watch?v=heqsk8pZ9R8
Megha SachaniaMegha Sachania
Thanks for your help but its for aura component i need to implement JQuery in Lightning Web Component
 
Megha SachaniaMegha Sachania
As I am using simply a button click event:

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}"