Classes bg-neutral-300 and text-indigo-600 removed from currently active element;
Class text-gray-700 added to currently active element;
Classes bg-neutral-300 and text-indigo-600 added to clicked on element;
Classes hover:text-indigo-600 and hover:bg-neutral-300 removed from clicked on element.
I don't want hyperscript to traverse entire DOM (looking for .tab class or something) and work only on "a" children of "ul";
I want it to work even if click was on svg inside a element.
I tried using take and toggle commands and expressions like event.target.closest('<a/>') and couldn't achieve the result. I also struggled to understand how to add/remove several classes at once.
Hello ! I'm new to hyperscript and after trying for couple hours I couldn't implement toggling in the following snippet
What I want to happen on click is
bg-neutral-300
andtext-indigo-600
removed from currently active element;text-gray-700
added to currently active element;bg-neutral-300
andtext-indigo-600
added to clicked on element;hover:text-indigo-600
andhover:bg-neutral-300
removed from clicked on element.I tried using take and toggle commands and expressions like
event.target.closest('<a/>')
and couldn't achieve the result. I also struggled to understand how to add/remove several classes at once.Could you please help me ?