문제

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.

도움이 되었습니까?

해결책

Found solution, needed quotes around #my_modal_

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top