I created a discourse theme component to show a modal and now i want to close the modal by clicking on the cross button on the modal. and run some javascript code, but it seems none of the javascript code is running
Since you’re running normal JS and not with the api, you can remove the version
attribute of the <script>
tag.
1 Like
Hey welcome!
It might be because you have multiple ìd
defined on the close button.
If you remove id=close
, this should work.
On a side note, you might be interested in using the Discourse API.
I highly recommend using Theme CLI to create a Theme Component from your computer to edit with your editor. It’s easier to work with multiple files and the API.
Then, you could use the Modal API to create and handle a modal!
4 Likes