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:
<script> var titr = element.getElementsByClassName('titre'); titr .id = "titre-</order_number_CMS_Field/>"; </script>
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 ?