Is it possible to reference the CMS with custom code?

I noticed that when I add a video link in the CMS it creates it as an embed in the editor. I attached a screenshot where it provides the Source as the “link from video” referencing the CMS.

Is their documentation for, or is it possible to do this with other things when writing custom code to reference the Webflow CMS? For example, if I wanted to write a function that is triggered upon clicking a button within a CMS div, could I write a function that targets the specific CMS ID attached to that particular CMS item?

Screenshot 2022-03-23 102911

On collection pages inside the HTML embed element, you have a button + Add field which connects to the CMS fields.

can’t believe I missed that, thank you

Do you know if it’s possible to do a dynamic reference to the ID of the CMS item itself?

You don’t need to reference an ID, if you want to run a code for each item inside a collection list, you can add the embed inside the dynamic item and take advantage of document.currentScript (supported by all browsers but IE, but who cares is deprecated nowadays :smiley: ) it will give you a reference to the script html element itself. So you can make a query on the closest .w-dyn-item and from there make your manipulation!

1 Like

thank you! :slight_smile: will try this out