-
before:
Is it possible to insert a reactive attribute into an existing node (#DIV-01) while not changing its child nodes? And how to add simple innerText to node? after:
|
Beta Was this translation helpful? Give feedback.
Answered by
Tao-VanJS
Feb 9, 2024
Replies: 1 comment 1 reply
-
I think probably the most straightforward way is to define an side-effect for the purpose: const reactive = van.state("VALUE")
van.derive(() => document.getElementById("DIV-01").setAttribute("data-reactive", reactive.val))
// Similar, for `innerText`
van.derive(() => document.getElementById("DIV-01").innerText = reactive.val) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Tao-VanJS
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think probably the most straightforward way is to define an side-effect for the purpose: