Hi Community People,
I am trying to create html elements like Div through javascript and want to append a button into it. As i am facing issues while doing this because i am confused now on which event of screen i need to write that JavaScript code. what i have tried.
1. first i take container and pass the id directly to the script and tried to append the button into which was never executing.
2. i tried to add div through javascript by createElement function and by calling that script into the onrender event and onready event both. Unfortunately in both actions none of JS is being called.
i am attaching my created OML as well. Please go through of it.
Now i am in cumbersome what to do. I am awaiting for your responses community.
Thanks
Ram Kumar
Hi @Ram Kumar ,
for starters, the reason nothing happens, is because you set an eventlistener for the dom being fully loaded, but both the ready and the render event happen AFTER that, so your event just never gets triggered.
If you remove the whole event and function thing, your div gets created,
but you add it to the body, it gets added at the end, below the footer, you can't scroll your div into view.
Anyway, the real question is why you want to do this, what features would that div and button have that you couldn't achieve with just adding a container and button in your design in service studio ???
Dorine