set

operator fun set(name: String, value: JsonPrimitive): Element(source)

Set an attribute of this element. For example a().setAttribute("href", "http://kweb.io") will create an <a> element and set it to <a href="http://kweb.io/">.


fun set(name: String, value: JsonPrimitive, namespace: String? = null): Element(source)

Set an attribute of this element. For example element["href"] = "http://kweb.io" will create an <a> element and set it to <a href="http://kweb.io/">.

Parameters

namespace

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


operator fun set(name: String, value: String): Element(source)
operator fun set(name: String, value: Boolean): Element(source)
operator fun set(name: String, value: Number): Element(source)


operator fun set(name: String, value: KVal<out JsonPrimitive>): Element(source)

Set an attribute to the value in a KVal, if the value changes the attribute value will be updated automatically.