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.
Tarun Chawla
04/23/2021, 1:49 PM
@Cicero I changed it thanks.
💪🏽 1
Tarun Chawla
04/23/2021, 1:49 PM
Other issue is even this statement is failing:
Copy code
val form = document.getElementById(key) as HTMLFormElement