You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initially, I tried to render an HTML page within an open dialog. I used ui.html, but I discovered that my HTML code contained JavaScript code, so I used ui.add_body_html. The code didn't report any errors, but I didn't get the result I wanted; my HTML didn't render.
I kept ui.add_body_html, but removed the js code from the parameters. I found that the code was executed, but my html result was displayed on the main interface instead of in the dialog.
As a beginner, I don't know if this is a feature of nicegui, but I really want to know how to achieve my original goal: rendering HTML content with JavaScript code into my dialog window.
Looking forward to your reply.
fromniceguiimportuidefopen_dialog():
withui.dialog() asdialog, ui.card().classes('w-full h-full'):
ui.label('This is a dilog')
ui.add_body_html('<p style="color: red;">This is custome HTML content</p><script type="text/javascript">console.log("hello")</script>', shared=True)
ui.button('close', on_click=dialog.close)
dialog.open()
ui.button('open dialog', on_click=open_dialog)
ui.run()
The text was updated successfully, but these errors were encountered:
Description
Initially, I tried to render an HTML page within an open dialog. I used ui.html, but I discovered that my HTML code contained JavaScript code, so I used ui.add_body_html. The code didn't report any errors, but I didn't get the result I wanted; my HTML didn't render.
I kept ui.add_body_html, but removed the js code from the parameters. I found that the code was executed, but my html result was displayed on the main interface instead of in the dialog.
As a beginner, I don't know if this is a feature of nicegui, but I really want to know how to achieve my original goal: rendering HTML content with JavaScript code into my dialog window.
Looking forward to your reply.
The text was updated successfully, but these errors were encountered: