How to assign the linkElement ("this") in javascript for anvil.call

Hi,

When I run

<script>
$('#editor').trumbowyg()
.on('tbwblur', function(){ 
  var linkElement = this;
   anvil.call(linkElement, "change_html")
     .then(function (r) {console.log(r)});
});
</script>

linkElement is an instance of “Window”. How can I assign the correct value to it?

Hi @toon.sevrin,

Can you explain more about what you’re trying to do? Where is this script tag within your app? What are you trying to access using this (a component on a Form, the Form itself, …)?

If you can share a clone link for your app or a cut-down example app, that would be really helpful.

Generally speaking: if your script is in a Custom HTML Form, this refers to the HTML DOM element of the Form itself, and you can use JQuery selectors to get the HTML DOM elements of components on the Form.