# Access config node properties from HTML

**URL:** <https://discourse.nodered.org/t/access-config-node-properties-from-html/11629>\
**Category:** Developing Nodes\
**Created:** [28 May 2019 09:28 UTC](https://discourse.nodered.org/t/access-config-node-properties-from-html/11629 "2019-05-28T09:28:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsenden](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rsenden/32/35728_2.png) [@rsenden](https://discourse.nodered.org/u/rsenden)\
**Post date:** [28 May 2019 09:28 UTC](https://discourse.nodered.org/t/access-config-node-properties-from-html/11629/1 "2019-05-28T09:28:41Z")

</div>

I am developing a node that is configured with a config node. In the .js file, I can access the config node using `RED.nodes.getNode(n.config);`. How can I access the config node from the HTML?

My config node defines two fields `keyName` and `valueName`. In the actual node, I have a select field with the following two options:

```auto
<option value="key">key</option>
<option value="value">value</option>

```

I would like to change the text for these options based on the `keyName` and `valueName` properties of the currently selected config node.

I think the best way for doing so (but please correct me if I'm wrong) would be to have something like the following in the `oneditprepare` function:

```auto
$("#node-input-config").change(function() {
   // The following doesn't work on HTML, how can I get the config node in HTML?
   var config = RED.nodes.getNode($(this).val()); 
   $('#node-input-select option[value="key"]').text(config.keyName);
   $('#node-input-select option[value="value"]').text(config.valueName);
});
            
$("#node-input-config").change();

```

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [28 May 2019 09:31 UTC](https://discourse.nodered.org/t/access-config-node-properties-from-html/11629/2 "2019-05-28T09:31:55Z")

</div>

> [@rsenden](#):
>
> var config = RED.nodes.getNode($(this).val());

There is a slight inconsistency between the runtime and editor's apis here.

Use `RED.nodes.node(...)` in the editor.

Remember to handle the case where a user has not yet added a config node so there is no such node.

---

<div class="post-metadata">

**Author:** ![rsenden](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rsenden/32/35728_2.png) [@rsenden](https://discourse.nodered.org/u/rsenden)\
**Post date:** [28 May 2019 09:34 UTC](https://discourse.nodered.org/t/access-config-node-properties-from-html/11629/3 "2019-05-28T09:34:50Z")

</div>

> [@knolleary](#):
>
> RED.nodes.node

Great, thanks! It works now 🙂

---

<div class="post-metadata">

**Author:** ![razorRun](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/razorrun/32/27847_2.png) [@razorRun](https://discourse.nodered.org/u/razorRun)\
**Post date:** [2 February 2020 11:37 UTC](https://discourse.nodered.org/t/access-config-node-properties-from-html/11629/4 "2020-02-02T11:37:26Z")

</div>

Hey Guys,

Is there any way to access the runtime of config JS file. For an example I have created a connection to a cloud server inside the config node's JS file. I can access this in other JS files using `RED.nodes.getNode`. But in the HTML, I only can get the text box values using `RED.nodes.node`. Is there any way to access the JS runtime ? or do I have to handle these connections separately

---

<div class="post-metadata">

**Author:** ![greggwon](https://avatars.discourse-cdn.com/v4/letter/g/3be4f8/32.png) [@greggwon](https://discourse.nodered.org/u/greggwon)\
**Post date:** [21 July 2020 19:46 UTC](https://discourse.nodered.org/t/access-config-node-properties-from-html/11629/5 "2020-07-21T19:46:14Z")

</div>

I can't find documentation for RED.nodes.node() and its argument(s). Where is this documented at?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 July 2020 19:47 UTC](https://discourse.nodered.org/t/access-config-node-properties-from-html/11629/6 "2020-07-21T19:47:05Z")

</div>

The editor apis are not fully documented. `RED.nodes.node()` takes a single argument - the id of the node you want.

---

<div class="post-metadata">

**Author:** ![Stwissel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stwissel/32/126_2.png) [@Stwissel](https://discourse.nodered.org/u/Stwissel)\
**Post date:** [7 November 2023 15:28 UTC](https://discourse.nodered.org/t/access-config-node-properties-from-html/11629/7 "2023-11-07T15:28:22Z")

</div>

~~How to get the id of config nodes in the edit dialogue?~~

Silly me:  
The main node has the IDs as properties
