Reputation: 1386
Is there anyway to add an id to a <g:link>
tag?
In my .gsp file, I have the following code:
<g:link controller="application" action="index" id="my_id">My Link</g:link>
Grails produces the following HTML:
<a href="application/index">My Link</a>
According to the grails documentation, id is a valid attribute for <g:link>
. So why is my id gone? Is there any workaround to tell grails to keep the id there?
Thanks!
Upvotes: 1
Views: 770
Reputation: 24776
Yes, it's possible. Use elementId
instead of id
. Like this:
<g:link controller="application" action="index" elementId="my_id">My Link</g:link>
You can read more about the attributes for the link
tag in the documentation.
Upvotes: 5