setAttribute

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

Deprecated

Use set() instead

Replace with

set(name, value, namespace)

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/">.

Parameters

namespace

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


fun setAttribute(name: String, value: String): Element(source)
fun setAttribute(name: String, value: Number): Element(source)

Deprecated

use set() instead

Replace with

set(name, value)

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

Deprecated

use set() instead

Replace with

set(name, value)

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