I’ve been trying to expand on the hello_chat application. I wanted to replace the contents of the “body” tag, but can’t seem to find a method for doing so. I assumed Dom.transform([Dom.select_body <- content]) would do the trick, but was apparently mistaken. In the end I just created a div with the ID “everything” to wrap the page, but the question is still bugging me.
How would I do a transformation on the “body” tag? Is it possible? Even better, is there any way to use CSS selectors to do transformations on one or many elements at once?
First simple solution :
Opa adds an id ‘Body’ to the
<body>.Second solution :
Notice the curly brackets around the Dom.select_XXX, and the function call
http://doc.opalang.org/api/index.html#dom.opa.html/!/value_stdlib.core.xhtml.Dom.select_body
Third solution :
You can also use raw CSS selector 🙂
http://doc.opalang.org/api/index.html#dom.opa.html/!/value_stdlib.core.xhtml.Dom.select_raw