# Question: how to show/hide elements in editable lists depending on options

**URL:** https://discourse.nodered.org/t/question-how-to-show-hide-elements-in-editable-lists-depending-on-options/44532
**Category:** Developing Nodes
**Created:** [22 April 2021 10:05 UTC](https://discourse.nodered.org/t/question-how-to-show-hide-elements-in-editable-lists-depending-on-options/44532 "2021-04-22T10:05:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)
#### Post date: [22 April 2021 10:05 UTC](https://discourse.nodered.org/t/question-how-to-show-hide-elements-in-editable-lists-depending-on-options/44532/1 "2021-04-22T10:05:10Z")

</div>

Hi,

I currently designing a new custom node. For user options I like to use the editable lists widget. All works fine. Now I like to present specific options depending on selections:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/c/9ccd8cd48e659337e5c5d4903c324eb7b3be4eb6.png)  
all fine when I open the config panel (hinding the unused options with `display:none`  
And I can hide the inputs depending on the selected options:

```auto
                options.each(function (i) {
                    var option = $(this);
                    var component = option.find(".node-input-option-component");
                    var type = option.find(".node-input-option-type");
                    var min = option.find(".node-input-option-min");
                    var max = option.find(".node-input-option-max");
                    debugger;
                    if (component.val()=="slider") {
                        type.show();
                        if (type.val()=="kelvin temperature") {
                            min.show();
                            max.show();
                        } else {
                            min.hide();
                            max.hide();
                        }
                    } else {
                        type.hide();
                        min.hide();
                        max.hide();
                    }
                });

```

But I'm stuck how to do this with the labels:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/7/e709541f2d2a156e3ba4ffe47386b398f4ab50a9.png)

I defined them like this:

```auto
                    $('<br>')
                        .css('class','node-label-option-max')
                        .css('display',(data.type=="kelvin temperature") ? 'inline-block' : 'none')
                        .appendTo(row);
                    $('<div><span>max</span></div>')
                        .css('class','node-label-option-max')
                        .css('display',(data.type=="kelvin temperature") ? 'inline-block' : 'none')
                        .css('width','35px').css('padding-left','19%').appendTo(row);

```

But can't "find" them:

```auto
                    var labelMax = option.find("node-label-option-max"); // tested # and .
                    labelMax.hide();

```

I'm a newbee in modern HTML5/jquery stuff ... Any help appreciated. It would be ideal if I can somehow tie the lable together with the input.

Chris

---

<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: [22 April 2021 10:21 UTC](https://discourse.nodered.org/t/question-how-to-show-hide-elements-in-editable-lists-depending-on-options/44532/2 "2021-04-22T10:21:31Z")

</div>

> [@Christian-Me](#):
>
> `.css('class','node-label-option-max')`

Hi @Christian-Me

The `.css(..)` function is for setting specific css styles, whereas the class is an attribute.

To set the class name of an element you'd do:

```auto
.addClass('node-label-option-max')

```

---

<div class="post-metadata">

### Author: ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)
#### Post date: [22 April 2021 10:36 UTC](https://discourse.nodered.org/t/question-how-to-show-hide-elements-in-editable-lists-depending-on-options/44532/3 "2021-04-22T10:36:57Z")

</div>

Great, that does the trick.  
Thank you!

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [6 May 2021 10:36 UTC](https://discourse.nodered.org/t/question-how-to-show-hide-elements-in-editable-lists-depending-on-options/44532/4 "2021-05-06T10:36:58Z")

</div>

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