Create options dynamically with crayons

Hello guys, I’m trying to dynamically assemble the options for a fw-select:

image

my js:

console.log:

how could I do to dynamically assemble options that way?

hey @Marllon_Mainardes,

Welcome to the Freshworks developer forum, hope you are safe :slight_smile:

I suppose the issue that you are facing is that the select box doesn’t render in the HTML? if so, could you please try the following approach,

Append the fw-select element with options to parent div instead of appending fw-select-options to the fw-select element like in the example given below.

HTML

JS


Output

Hope this helps

Have a Good Day :slight_smile:

2 Likes

thank you very much!

@Marllon_Mainardes,

Usually the way you have written will work, if it doesn’t the reason will be that the event fwBlur is not bound to the element, in that cases, you have to bind the event to the element, an example is given below for that approach.

1 Like