container onClick change Color - How To?

1
Hi, I’m building an Edit page which is a bit like from the Tasks&Planning Template in Mendix. I have some on click container things… In the template it looks like this:  the buttons got a surroundiing and also you see what is selcted and also with different colors. And yeah mine is looking so:  no color, no surrounding… how is this working to get it like in the template?   Thanks nico
asked
1 answers
0

The easiest option I would suggest is adding a :focus state in your css (this styles a ‘selected’ button) however this might only work untill (any) other button is clicked, another option I would recommend is adding a jQuery snippet (through HTMLSnippet on the marketplace) and applying an onClick listener that adds a class for the extra styling.

It would result in this code into a snippet:

$(‘.class-of-clickable-item’).on(‘click’, function({

         $(‘.class-of-item-to-change’).addClass(‘class-name-with-highlight’);

});

Using this you can also make it removable with .removeClass(‘class-to-remove’)

answered