How do I change the style of an element in KotlinJ...
# javascript
k
How do I change the style of an element in KotlinJs? Something like this doesn't seem to work, the property
style
doesn't exist:``` val tabs = document.getElementsByClassName("tabContent") tabs.asList().forEach { it.style.color = "red" } ```
k
CSS?
k
Right but I want to change the style of an element in code, for example I want to show/hide a div at the press of a button.
(trough Kotlin of course)
It's kinda dumb because doing this just works:
Copy code
val tabs = document.getElementsByClassName("tabContent")
    tabs.asList().forEach {
        val a : dynamic = it
        a.style.color = "red"
    }
For now I've defined this:
private val Element.style get() = this.asDynamic().style
, I hope there's a better solution.