Skip to main content
Question

Variable to target a text-input in my code.ts


Alessandro_Mastrogiacomo

I’m stuck. I’m no developer but trying to build a simple plugin. Since here it’s working, some bumps along the road, but there’s a tiny stone that it’s giving me a hard time. Basically, I have an input for saving a class (frame with some property applied), and after I save a class I need to clear that input in the UI. What’s the variable that targets the input element in my code.ts file? I’m trying to target using this code:

const input = document.getElementById("className") as HTMLInputElement;
input.value = '';

But when compiling it gives me errors both for the document and the HTMLInputElement.
What am I doing wrong? It should be quite simple to clear an input after saving something. Thanks for you help.

This topic has been closed for comments

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings