본문 바로가기
IT/Thymeleaf

[Thymeleaf] - 타임리프 th:onclick, th:onkeyup, th:onchange 사용법 및 문법

by 차이나는 개발자 2022. 1. 31.
728x90
반응형

#타임리프 th:onclick, th:onkeyup, th:onchange 사용법 및 문법

 

 

#th:onclick, th:onkeyup, th:onchange

 

// th:onclick
<button type="button" class="btn" th:onclick="onClickTest(); return false;">클릭</button>

// th:onkeyup
<input type="text" id="userName" name="userName" th:value="${data.userName}" th:onkeyup="onKeyupTest(this)">

// th:onchange
<select id="userType" name="userType" th:onchange="onchangeTest(this)">
  <option value="">선택</option>
  <option value="A" th:selected="${'A' == data.userType}">A</option>
  <option value="B" th:selected="${'B' == data.userType}">B</option>
  <option value="C" th:selected="${'C' == data.userType}">C</option>
</select>

 

 

 

728x90
반응형

댓글