Browser: Chrome Version 120.0.6099.130 OS: Windows 11
Bug or Feature?!
Basically, I created a Form with various elements. One of the elements was a select element (dropdown). I wanted to style the option depending on what option was chosen.
This is the problem (bug?) I ran into: every time I change the JavaScript in Bricks and save, the select element gets a new id assigned. This makes it impossible to grab the element via its id.
My workaround: the select element has a unique name attribute, which you can use to grab the element.
May I know if you are referring to Bricks form?
I don’t think we have Select element.
The select field inside the Bricks form got a unique ID and it’s static upon creation.
Note, that the id shown here is the last part of the name attribute (as seen in the video) of the select element. But the id, as seen via Chrome dev tools, is different.
Thanks for the video. Now I get what you mean.
The input ID will be generated randomly to avoid duplicated ID if the Form is using in Query Loop. Which is the expected result.
To address this issue, you can target your select input by using the name attribute. form-field-jvozfu