Frage

I am using special character '#' as follows:

th:attr="data-target=#my_modal_+${myObject.id}"

This fails with error because of special character '#'

Could not parse as assignation sequence

If i remove '#' it doesnt throw error but doesn't work as intended.

War es hilfreich?

Lösung

Found solution, needed quotes around #my_modal_

th:attr="data-target='#my_modal_'+${myObject.id}"

Andere Tipps

In your HTML change id="my_modal" to class="my_modal"

Then you could do something like

th:attr="data-target=.my_modal_+${myObject.class}"

By using a class which in CSS uses a "." instead of a "#" this should hopefully resolve the issue.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top