CSS class add/remove


I have TWebLinkLabel component on the form with defined ElementID what is used in html template to act as navbar-item. What can be the way to change/add CSS class for this element, for example - add CSS class "disabled"?

Setting in code TWebLinkLabel.Disabled:=True for this element works, but not represents disabled state visually.


When you link to a HTML element in the template the CSS of the element used in the HTML template is given priority (by design). So, I'd suggest to use a CSS class for disabled state in this case.
You can programmatically also change the CSS for an element with control.ElementHandle.style.SetProperty('propertyname','propertyvalue');

Thank you sooo much, Bruno, for this hint. Actually, my question was exactly on how to, at runtime, add CSS class (in my case "disabled") to existing classes of HTML element. But you covered even more :)

So, for any one, who will be looking on how to dynamically add/remove classes for linked object to HTML element - check control.ElementHandle.classList.
To work with direct style - check control.ElementHandle.style.