1
0
-1

Hi everyone,

I'm currently working on a Select Box with hardcoded options. Each option has a Value, Label, and Grouping field filled in. Here's how my option is set up:

I want to use JavaScript (in Custom HTML) to get the grouping value of the selected option when the user changes the selection. I'm able to get the value and label using val() and text(), but I’m not sure how to access the grouping.

Is there a correct way to read the grouping field from the selected option?
Would appreciate any guidance or code examples!

Thanks in advance!

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi, you can access the grouping by using the following snippet,

      var grouping = selectedOption.attr("grouping");

      I hope it works for you!

      CommentAdd your comment...
    2.  
      1
      0
      -1
         var grouping = $(field).find(':selected').attr('grouping');
      
      CommentAdd your comment...