Feature Request: this

In the workflows, it would be great to have a “this” (or something like it). For instance, when I click on a text…

this.style.color = “red”

1 Like

Neat! Just added your request to our user research :slight_smile:
Thanks John!

HI @John,
inside workflow you can access the element through context.element. Its not available in the code explorer (hidden feature), but its here. With a custom javascript action, you can do this

context.element.style.color = "red"

BUT

I strongly discourage that. This element is handle by Weweb (and Vue internally), so your custom changes will probably be erase the next time we try to update your DOM (which happens often).
The best way to achieve what you want is to think data first:

  • Define a variable handling the color of your text
  • Bind the color of your text to this variable
  • Change the variable value inside your workflow

Hope this help

1 Like

Ah, yes! This is actually very helpful… more so on elements that won’t be updated by DOM. For instance, creating an inline form edit element, I wanted to show a text edit icon when hovering over the parent container. This helps a lot with that. Or getting other children, sibling nodes. thx

1 Like