HTML, CSS

radio 버튼 중복 선택 변경, input type = "radio" name = "성별"

유호야 2020. 10. 28. 22:50
반응형

input type = "radio" 일때 중복 선택이 되지 않게 하는 방법

뒤에 name을 붙인다. 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
</head>
<body>
    <form>
        <label for = "name">이름</label>
        <input id = "name" type = "text"> <br>
        <label for = "age">나이</label> 
        <input id = "age" type = "text"><br>
        <lable for = "sex">성별</lable>
        남 <input type = "radio" name = "sex">
        여 <input type = "radio" name = "sex">
      
    </form>
</body>
</html>
반응형