html

<body>
  <div class="tm">오늘의 기분</div>
  <div class="category">
    <input type="radio" value="기쁨" name="mood" class="mood" onclick="moodChoice(event)" checked="checked">기쁨
    <input type="radio" value="슬픔" name="mood" class="mood" onclick="moodChoice(event)">슬픔
    <input type="radio" value="분노" name="mood" class="mood" onclick="moodChoice(event)">분노
    <input type="radio" value="피곤" name="mood" class="mood" onclick="moodChoice(event)">피곤
    <input type="radio" value="설렘" name="mood" class="mood" onclick="moodChoice(event)">설렘
    <input type="radio" value="우울" name="mood" class="mood" onclick="moodChoice(event)">우울
    <div id='mood'></div>
  </div>
async function moodChoice(event){
  document.getElementById('mood').innerText = 
  event.target.value;
  const mood = document.getElementById('mood').innerText
  console.log(mood)
}
profile
가보자고

0개의 댓글