here is a working code that adds a “!” to the innerHTML of the
var list = document.getElementById("pannel") as HTMLDivElement
var contactPannel = document.createElement("div") as HTMLDivElement
contactPannel.innerHTML = "name"
contactPannel.onclick = {
contactPannel.innerHTML = contactPannel.innerHTML + "!"
var newRow = document.createElement("div") as HTMLDivElement // does not work when commented out
list.appendChild(newRow) // does not work when commented out
}
list.appendChild(contactPannel)
the same code with only two lines commented out does not work
var list = document.getElementById("pannel") as HTMLDivElement
var contactPannel = document.createElement("div") as HTMLDivElement
contactPannel.innerHTML = "name"
contactPannel.onclick = {
contactPannel.innerHTML = contactPannel.innerHTML + "!"
// var newRow = document.createElement("div") as HTMLDivElement // does not work when commented out
// list.appendChild(newRow) // does not work when commented out
}
list.appendChild(contactPannel)
for some stange reasons i get the error “Kotlin: Expeced a value of type dynamic” for the line where i try to add the “!” to the innerHTML. can anybody explain the meaning of that error message?