element

fun element(tag: String, attributes: Map<String, JsonPrimitive> = attr, namespace: String? = null, new: ElementCreator<*>.(Element) -> Unit? = null): Element(source)

Create a new element, specifying its tag and attributes.

Tag-specific functions like p, select, and others call this function and should be used in preference to it if available.

Parameters

tag

The HTML tag, eg. "p", "select", "a", etc

attributes

The HTML element's attributes

namespace

If non-null elements will be created with Document.createElementNS() with the specified namespace. If null then Kweb will use Document.createElement.




fun element(receiver: PARENT_TYPE.() -> Unit)(source)

Deprecated

div { element { set("foo", "bar")} } ===> div { it.set("foo", "bar") }

Replace with

receiver(element)