상세 컨텐츠

본문 제목

Thymeleaf th:attr 의 사용 이유

Programming/Thymeleaf

by 노란날. 2023. 1. 3. 14:50

본문

반응형

 

😶‍🌫️ 문제점

<button type="button" onclick=openModal('${comment.id}', '${comment.user_name}', '${comment.comment}' ) class="bi bi-pencil"></button>

이렇게 하면 모달창은 뜨지만 '${comment.id}' 형태로 값이 그대로 들어간다.

 

 

✨ 해결

<button type="button" th:attr="onclick=|openModal('${comment.id}', '${comment.user_name}', '${comment.comment}' )|" class="bi bi-pencil"></button>

th:attr을 사용했다.

반응형

'Programming > Thymeleaf' 카테고리의 다른 글

Tymeleaf 선택변수 *{} 표현식  (0) 2023.01.03
Thymeleaf Reference Site  (0) 2023.01.03

관련글 더보기