Thymeleaf placeholder in input type = "text"

I have this input text in

<input type="text" id="usernameId"  name="username" placeholder="User" />

I want to replace the text of the User placeholder with 1 text from the properties file, but I don't know if this is possible

<input type="text" id="usernameId"  name="username" placeholder="th:text="#{user.placeholder}""  />
+4
source share
1 answer

There is a special Thymeleaf attribute for this:

<input type="text" id="usernameId"  name="username" th:placeholder="#{user.placeholder}" />

It can also be written like this:

<input type="text" id="usernameId"  name="username" th:attr="placeholder=#{user.placeholder}" />
+8
source

Source: https://habr.com/ru/post/1676504/


All Articles