# How to get selected the item in dropdown and dropdown is part of custom node property

**URL:** <https://discourse.nodered.org/t/how-to-get-selected-the-item-in-dropdown-and-dropdown-is-part-of-custom-node-property/12660>\
**Category:** Developing Nodes\
**Created:** [27 June 2019 12:50 UTC](https://discourse.nodered.org/t/how-to-get-selected-the-item-in-dropdown-and-dropdown-is-part-of-custom-node-property/12660 "2019-06-27T12:50:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kiran007](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@kiran007](https://discourse.nodered.org/u/kiran007)\
**Post date:** [27 June 2019 12:50 UTC](https://discourse.nodered.org/t/how-to-get-selected-the-item-in-dropdown-and-dropdown-is-part-of-custom-node-property/12660/1 "2019-06-27T12:50:15Z")

</div>

.html file code to add dropdown in custom node property

```auto
<div class="form-row">
		 <label for="node-input-userValue"><i class="fa fa-calculator"></i> Value</label>
     <select id="node-input-userValue">
	 <option>1</option>
	 <option>2</option>
     </select>
	 </div>

```

and i am trying to access it in .js file of same custom node like

```
    var node = this;
    node.on('input', function(msg) {
    var selected_item= node.userValue;			
    outMsg = {payload: node.userValue}
    node.send(outMsg);
    });
```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [27 June 2019 13:16 UTC](https://discourse.nodered.org/t/how-to-get-selected-the-item-in-dropdown-and-dropdown-is-part-of-custom-node-property/12660/2 "2019-06-27T13:16:40Z")

</div>

Have you added `userValue` into the `defaults` section in .html?

```auto
RED.nodes.registerType('mynode',{
        category: 'function',
        color: '#a6bbcf',
        defaults: {
            userValue: {value:""}
        },

```

then in your .js ...

```auto
node.userValue = config.userValue || "none";

```

See here for reference : [https://nodered.org/docs/creating-nodes/first-node](https://nodered.org/docs/creating-nodes/first-node)

---

<div class="post-metadata">

**Author:** ![kiran007](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@kiran007](https://discourse.nodered.org/u/kiran007)\
**Post date:** [28 June 2019 09:06 UTC](https://discourse.nodered.org/t/how-to-get-selected-the-item-in-dropdown-and-dropdown-is-part-of-custom-node-property/12660/3 "2019-06-28T09:06:37Z")

</div>

Thanks it works for me thank you so much
