First thing, post code, not pictures of code. Please see Wiki - how to post code on this forum. It helps immensely by allowing others to copy & paste code to try it instead of trying to read & type from a picture. You can edit your post by clicking the pencil icon in the bottom right
Create a custom property on the component called selected
or active
or similar, and bidirectionaly bind it to the value of the tag. In your click script, put self.selected = not self.selected
. The bidirectional binding will take care of the rest.
I would highly recommend making this item a template and passing the expected tag path in as a parameter. You can then indirectly bind to the passed tag path.