can someone help me on this,how to see which radio...
# javascript
t
can someone help me on this,how to see which radio button is selected in a form in kotlin html dsl? am trying to replicate this code but am not able to .
Copy code
var coffee = document.forms[0];
var txt = "";
var i;
for (i = 0; i < coffee.length; i++) {
  if (coffee[i].checked) {
   txt = txt + coffee[i].value + " ";
   }
}
  document.getElementById("order").value = "You ordered a coffee with: " + txt;
In kotlin I wrote below code:
Copy code
val form = document.getElementById(key) as HTMLFormElement
for(element in form.elements.asList()){
  console.log("element value ${element.checked}")
}
But this is not working as there is no checked property.
@Cicero I changed it thanks.
💪🏽 1
Other issue is even this statement is failing:
Copy code
val form = document.getElementById(key) as HTMLFormElement