lbc9yg
Last Updated: February 25, 2016
·
2.423K
· rodnaph
6e283a554e50ee3d10e5386f85816463

Append HTML with Enlive

Setting the content of nodes to either escaped text (using content), or HTML (using html-content) is pretty obvious. But here's how you can use HTML with the other Enlive transformers.

[:div] (append (html [:script "alert('Hello, World!')"]))

The html function takes a Hiccup style data structure of nodes which it will convert to an Enlive map for the HTML.

(html [:div.control-group [:label.control-label "Label:"]])

Very useful.

Say Thanks
Respond