Streaming live at 10am (PST)

Add an id to the body

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?


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.


document.addEventListener('load', on);

This has now been removed.

document.body.setAttribute('id', 'bodyId');
1 Like

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

then be replaced by:

document.addEventListener('load', init);

Is that correct? Bests, Ben