How to set ID Attribute to a page when a condition is true?

Hello everyone…

How to set ID Attribute to every single page that is loaded from Header when I press a button or when a condition is true.


I’m not sure I understand the question…

Can you give an example of what you’re trying to do?

I want to stop the page from scrolling when I open a popup. I can do this with Javascript. But every page must contain an ID attribute to make it work. I want to set that attribute before the javascript is running and before the popup is open (in this case I have a floating group but it doesn’t matter)

I don’t want to write the attribute to every single page manually.

Why not? Isn’t that the simplest way?

In any case, I guess you can use some simple JavaScript to set the page ID attribute on pageload - it might be a bit slower than just having it set already on the page though.

1 Like

Yeah… it is… And that’s what I’m gonna do. I thought in case I need to use the ID Attribute for other things… (sure I can use one name for everything but it can be confusing)

Maybe I can use a custom state and change the value when I need it. Does it work?

Thanks for your answer Adam

I agree that updating this manually would be the easiest way.

If you wanted an alternative, could you create the attribute as an option set, then dynamically reference this for each field.