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
{{ message }}
Repository navigation
Support for string events (to execute raw javascript) #1261
There's currently no existing capabilities for running a JS script from within an event tag.
Additionally, string based events serialized from html_to_vdom currently do not execute at all.
Proposed Actions
Allow events to be declared as string type. If the event is a string, pass it directly into React's prop dictionary, which will allow it to execute as traditional javascript.
@componentdefmy_component():
returnhtml.button(
{ "onClick": "$('.sidebar').toggle()" },
"This is a button!",
)
In this scenario, providing a str within onClick would execute the event string the client side.
changed the title [-]Support executing javascript within events by declaring them as string type[/-][+]Support for string events (to execute raw javascript)[/+]on Jan 28, 2025
Activity
[-]Support executing javascript within events by declaring them as string type[/-][+]Support for string events (to execute raw javascript)[/+]Archmonger commentedon Sep 3, 2025
Fixed in #1290