SPFX webpart on sharepoint online

Mustapha Ait Bencheikh 41 Reputation points
2021-02-01T14:54:59.367+00:00

​I want to develop my own webpart spfx sharepoint online :I have a simple code html/javascript and I want to insert this code on my webpart spfx.
the HTML code I inserted on render and still JavaScript this is an image to explain
62529-image.png

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,629 questions
{count} votes

Accepted answer
  1. Amos Wu-MSFT 4,051 Reputation points
    2021-02-04T07:14:11.153+00:00

    We could use document.getElementById(id) to get the target element.And you could take a reference to add event listener for button click:https://social.technet.microsoft.com/wiki/contents/articles/53182.spfx-webpart-how-to-add-event-listener-for-button-click.aspx
    My test code for your reference:63865-code.txt
    63894-carbon.png
    Test result:
    63913-test80.gif


    If the response is helpful, please click "Accept Answer" and upvote it.
    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.


1 additional answer

Sort by: Most helpful
  1. Dattatray Patil 86 Reputation points
    2021-02-01T19:20:35.33+00:00
    0 comments No comments

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.