After deployment, can we interact with HTML elements present inside SPFx?

Shailesh Jaiswal 81 Reputation points
2022-12-24T20:23:54.83+00:00

I know SPFx uses same DOM and it can interact with other elements of the page but what about apposite direction?

Suppose if we are using Modern Script Editor Web Part then can it interact (click, show or hide) with the HTML elements which are present in SPFx web part or extension (assuming SPFx web part or extension was already successfully deployed and working fine on page)

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,230 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tong Zhang_MSFT 9,246 Reputation points
    2022-12-26T02:37:31.617+00:00

    Hi @Shailesh Jaiswal ,

    According to my research and testing, SPFx can interact with other controls. Based on my testing, when we use the Modern Script Editor web part, we can interact with other Web Parts. For example, we can hide or show other Web Parts, but when I try to hide/show HTML elements in other web parts, it failed. In my test, SPFx can interact with other controls, but cannot interact with HTML elements in Web Parts.

    More information for reference: Overview of the SharePoint Framework

    Hope it can help you. Thanks for your understanding.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.