Saving node parameter in an variable in the html file

I have a node for which i am setting different attributes (Name, fruit, vegetable) from a typedInput.

For further processing, I want to get the values that I set for each parameter into my html file in which i define the node. I have tried using $('node-input-param_name').typedInput.('value') as mentioned by the documentation on the typed Input webpage. TypedInput - get value but it didn't work, and it returns something like s.fn.init [prevObject: s.fn.init(1)].

I can't find a way to get the string value that I chose for the parameter in node-red, and assign it to a variable in my htm file.

Thank you!

Try without the dot after typedInput

const v = $('node-input-param_name').typedInput('value')

Also depends on the typed input type. For example some only have type and no value...

const t = $('node-input-param_name').typedInput('type')

Thanks for the reply !

I aleady had it without the dot, it was a typo while creating the issue, sorry about that.

Unfortunately, passing the ('type') argument doesn't work as well. I am getting undefined as output now.

Are you aware of any node that implements such a functionality, so I can check its source code on github for example?

Sorry, also just noticed you don't have a # symbol at the beginning of the selector...

const v = $('#node-input-param_name').typedInput('value')

That solved it. :man_facepalming:

Apologies and thanks for replying so quick.

I couldn't find advanced documentation for stuff like this, and was relying simply on examples and posts from other people on the forum, is there a place where such documentation is found?

Yes, in the official docs. Link at top of forum...

https://nodered.org/docs/api/ui/typedInput/

Thanks for helping out !

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.