Hi, The easiest way I could imagine is with a short jQuery function that is called on domready.
If you need to do it on the server side then maybe with IResponseFilter. On Wed, Jun 29, 2022, 12:38 Daniel Radünz <ihmehlm...@gmx.de> wrote: > Hello everybody, > > I'm wondering if there is a way in Wicket to generate unique html IDs and > to then add them in other places in the html, without having to write any > boiler plate code in each panel that I have. > > For example in the following panel I need the ID of the h1 tag to be put > into the aria-labelledby attribute in the section tag. > <wicket:panel> > <section class="card" aria-labelledby="sectionheader"> > <div class="card-header"><h1 id="sectionheader">Lorem > ipsum dolor sit amet</h1></div> > <div class="card-content">Content ...</div> > </section> > </wicket:panel> > > Hardwiring it like in this example of course won't work if I use the same > panel class multiple times within a page due to duplicate html IDs. > > While I know I could add WebMarkupContainers for the section and the h1 to > my Java code and manually wire them together with an AttributeModifier in > Wicket, I woud prefer to have some application wide code which recognizes > this constellation in the html file and automatically generates and inserts > the IDs. > > Maybe somebody can push me in the right direction, how I could accomplish > this with Wicket, if it's possible at all. > > Kind regards, > Daniel > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >