Is the javascript code example valid?

This page talks about the use of $("<node-name>").item using a javascript code snippet to show functionality.

The caveat according to this same page is, however:

Not avaialble in Function node
(typo in the word “available btw”)
and below says:
$(“”).item isn’t available in the Function node.

Isn’t this a bit misleading? Since you can only write JS code in this format in a function node? If it can’t be written in this format, then maybe another should be supplied like {{$node["node-name].parameters}}

Also, when using this object in another node, it looks like the item object isn’t accessible, and the parameters/binary/json object can be accessed on the top level rather than being nested under item.

Have I missed something?

Hi @Adrian-Samuel, the Function node has been replaced with a “Code” node in recent versions of n8n. Perhaps you can try upgrading your n8n version? Afterwards you should be able to use this snippet.

Once upgraded, this expression should also work in other nodes, I just tested this in the Set node:

Hope this helps! Let me know if you run into any trouble with this.

1 Like