Streaming live at 10am (PST)

Add an id to the body

Hi,
I need to add the id=“home” at the body tag of the page;
then i need to add also onload="on()
Finally, the body tag of a page will be:
<body class="body" id="home" onload="on()">

In the exported webflow code i need exactly:
<body class="body" id="home" onload="on()">

It’s possibile to set the body tag in this way inside the webflow designer?

Thanks,

You can set the id in the element settings panel.

As for the onload attribute, you have to attach an event listener via JavaScript instead.

e.g.:

<script>
document.addEventListener('load', on);
</script>
2 Likes

This has now been removed.

<script>
document.body.setAttribute('id', 'bodyId');
</script>
1 Like

Hi, would:
<body onLoad="init()">

then be replaced by:

<script>
document.addEventListener('load', init);
</script>

Is that correct? Bests, Ben