ZelelB
ZelelB

Reputation: 2010

Can we use the Wicket:id to make CSS?

is it possible to use the wicket:id of some element/component for CSS styling instead of "class"?

for example:

.tooltipster-arrow span, .column-shifter {
    display: block;
    width: 0; 
    height: 0;
    position: absolute;
}

and i have in html code something like:

<body>
    <wicket:panel>
        <div wicket:id="column-shifter"></div>
    </wicket:panel>
</body>

Thanks!

Upvotes: 2

Views: 1039

Answers (2)

phm
phm

Reputation: 108

This is not possible, as the browser will look for the class attribute when processing CSS. Furthermore, Wicket markup is removed in deployment mode, so the wicket:id attribute should not be present in the final HTML (as it would reveal internal data of your application).

You could use an AttributeModifier to add the ID of your component as class attribute:

myComponent.add(new AttributeModifier("class", myComponent.getId()));

Upvotes: 7

thg
thg

Reputation: 1235

You can just add a class="column-shifter" to the markup, like this:

<div wicket:id="column-shifter" class="column-shifter"></div>

Upvotes: 3

Related Questions