Share via

Where can I change javascript code and CSS code in my webpart files?

Anonymous
2023-08-11T23:10:06+00:00

Hello,

I'm building an accordion webpart using this link: https://learn.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/add-jqueryui-accordion-to-web-part#build-the-accordion 

I've completed all the steps and the accordion that shows up with the code provided works great. However, I'm trying to change up the code to make a nested accordion using the code from this site: https://codepen.io/Elodieb/pen/OJyLxXm 

I don't understand which file or section I should put in the necessary Javascript code. I updated the HTML in the MyWebpartTemplate.ts file and I assume the CSS code goes in the Webpart.module.scss file which are both under src\webparts\

Please help I've been stuck on this for hours and it's my first time doing front-end coding. The code editor im using is VSC

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2023-08-12T22:19:56+00:00

    Sure, I posted there but if anyone knows here, please reply! thank you

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2023-08-12T02:46:29+00:00

    Dear roroms,

    Good day!!

    I understand your concern and to my search, JavaScript code should go into the TypeScript file (MyWebpartTemplate.ts), and the CSS code should go into the SCSS file (Webpart.module.scss) but to get more information as it's related to SharePoint Online customization, I would like to suggest you to post your concern in the Questions - Microsoft Q&A with SharePoint Development tag to get the detailed help from the experts.

    We regret for redirecting you to a different community as the members in the category posted focus on the users with the Microsoft 365 and out-of-the-box SharePoint Online concerns and have limited knowledge on the customization of SharePoint Online using script, so to get the fast and better assistance, we have redirected you to the correct community.

    Thanks for your patience and understanding. Have a good day!!

    Best Regards,
    Sophia

    Was this answer helpful?

    0 comments No comments