Quantcast
Channel: how to pass a value using thymeleaf to data of bootstrap? - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Answer by Greg for how to pass a value using thymeleaf to data of bootstrap?

$
0
0

The following line makes no sense: data-id="th:text="${car.id}""

  1. The purpose of th:text is to modify the body text of the element (in this case, a button element). You're trying to set an attribute value.
  2. If you want thymeleaf to modify a data attribute like data-id, you need to th:attr instead

That line should be written as follows:

data-id="" th:attr="data-id=${car.id}"

If you want the data-id to have some default value like "example-id", do this:

data-id="example-id" th:attr="data-id=${car.id}"

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>