Unique Ids for Collections Items


1 - Add this to your head in custom code.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

2 - Add a number field to collection items called unique id number. Make sure that each collection item has a unique number in this field.

3 - Add a collection list to your page (skip if you already have your collections list).

4 - Create a paragraph element in your collection item and give it a class of ‘idtext’.

5 - Link that paragraph element so it gets text from the unique id number field and change the display to none.

6 - Add this code to an embed element or in custom code settings.

<script>$(document).ready(function(){ $('.w-dyn-item').each(function() {$(this).attr('id', 'item-'+ $(this).children('.idtext').text().trim());console.log("Unique Ids added");});  });</script>

done.

Ids will be ‘item-UNIQUE ID NUMBER’

*Make sure that the 'idtext' element is always left as a direct child of the collection item*

9596

32018

77253

15984

32288

95044

47599

19412

8635

77404