I have a simple drop-down menu, which is opened by a triangle (caret) symbol. I need to rotate caret upside-down (180 degrees), when the menu is opened, and go back to default position, when it is closed back. Ideal is to achieve this without engaging css classes, which would be the most commonly suggested solution, when I was looking up for the answer.
I have tried to use ternary operator on click, like this:
$(this).css('transform', ($(this).css('transform') == 'rotate(180deg)') ? 'none' : 'rotate(180deg)');
But it won't work; it rotates once - upside down - but does not go back to default position on next click. I have tried also with 'rotate(0deg)' and 'rotate(360deg)', same effect (no effect actually). What statement should I use instead?