Streaming live at 10am (PST)

Dynamically attribute unique IDs to a specific class name elements inside a CMS collection

Hi ,

I have a one page portfolio in CMS.
Each section populated in CMS have a div block class named “titre”

I Want to give a unique ID of = ’ titre-[ x ] ’ to each element of class="titre"
(with [ x ] as a number CMS field )

How could I code this in an Embed code?

I’ve tried this but this is not working:

var titr = element.getElementsByClassName('titre');
 titr .id = "titre-</order_number_CMS_Field/>";

the selector element.getElementsByClassName(‘titre’); doesn’t work.

Do you have a magic trick to attribute a unique ID to each element of a specific class populate by CMS ?

Here is my public share link: Webflow - Julien Widmer Website
link :