如何指定HTML绑定到哪个表单元素?
在HTML中使用for属性来指定计算与HTML绑定到的表单元素。
示例
您可以尝试运行以下代码以实现 for 属性-
<!DOCTYPE html> <html> <body> <p>Education:</p> <form action=""> <label for = "graduate">Graduate</label> <input type = "radio" name = "education" id = "graduate" value = "graduate"><br> <label for = "ugraduate">Under-graduate</label> <input type = "radio" name = "education" id = "ugraduate" value = "ugraduate"><br> <input type = "submit" value = "Submit"> </form> </body> </html>