Skip to main content
1-Visitor
March 1, 2021
Question

JQuery in mashup function (ThingWorx 9.1)

  • March 1, 2021
  • 1 reply
  • 2962 views

Does ThingWorx 9.1 allow using JQuery in expressions?

1 reply

16-Pearl
March 2, 2021

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. 

1-Visitor
March 2, 2021

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:

 

 

$('#root_flexcontainer-2').css('background', 'rgb(0,0,0)');

 

 

In devtool it work, but when placed inside an expression it does not seem to do anything.

16-Pearl
March 3, 2021

I am not sure what all functions we can use. I tried using 

$('#root_flexcontainer-2').css('background', 'rgb(0,0,0)');

but I was unable to make it work. If I find a way, I will update it here.