I did a small test and validated that JQuery works in expression function in 9.1. Import the attached entity and view the mashup, on button click the expression function changes the URL.
Thank you for your response. I tried to find definite answer somewhere in the documentation but I wasn't able to. I've tested your example and yes, it works fine.
My other question as a follow up is, can you use other functions such as selectors and css()? I this is my main goal with JQuery, and I was testing your example with simple background change:
In devtool it work, but when placed inside an expression it does not seem to do anything.
I am not sure what all functions we can use. I tried using
but I was unable to make it work. If I find a way, I will update it here.
R&D strictly limited the functionality of jQuery over security concerns. I unfortunately as well am not sure what is and is not allowed.
Instead of setting CSS using jQuery I would highly recommend using your expression widget to set the custom class property on the widget you are trying to modify. This would ensure your solution is future safe and future developers would most likely look for custom css defined on the mashup not in an expression.
Of course I usually use custom classes, but jQuery was supposed to be a solution of an another issue. Because there are many shadow root in newer versions of widgets, custom css doesn't affect them. You can use
::part if the element has this property, but it doesn't always have it. That's why I was looking for a different way to modify specific elements of a page.
JJ, indeed, that is one of the issues of the shadow dom, the fact that a widget based on it it is no longer 100% customizable as the previous non-shadow dom widgets.
One of the main reasons the shadow dom was used is because it made sure that changes that one widget did via CSS classes no longer can reflect on other widgets - one of the issues of the older widgets.This is known as "style isolation"
Assuming you tried to use the ThingWorx Themes - which provide a global, across-widgets styling - and you did not find the necessary capabilities, if this severely impacts your workload, make sure that you:
1. Open a user request in the ThingWorx Ideas forum section detailing this request
2. Discuss this with your Customer Success Manager to understand the problem, its impact and to arrange a possible workaround - if possible.