How to unselect already selected tag, when clicked on another on in Selection Tag type of an element?

Hello,
Please if anyone knows how, give me an idea how to unselect already selected tags when clicking another tag.
I have a feeling that it should be a part of onChange type of an event, but can’t figure which function to use.
Please…?

please, anyone?

export function selectionTags1_change(event) {
$w("#selectionTags1").value = [$w("#selectionTags1").value[$w("#selectionTags1").value.length -1]];
}

or:

export function selectionTags1_change(event) {
	$w("#selectionTags1").value = [$w("#selectionTags1").value.reverse()[0]];
}

@jonatandor35 Thanks a lot.

Where should I put this in my code?

@bobargo1 could you tell me where to put that in my code? I tried to tag the mod but I couldn’t.

Hi @scarabin

A) Add code to a code snippit instead of an image.

Hi This is a code snippit

This way we can help easyer .

B) If you are trying to do exactly as explained above

Add the code in the selectiontag1BD.onChange

Kind regards,
Kristof

method 1 :

$w('#selectionTags1BD').onChange((event) =>{
$w("#selectionTags1BD").value =[$w("#selectionTags1BD").value[$w("#selectionTags1BD").value.length -1]];
}

method 2 :

$w('#selectionTags1BD').onChange((event) =>{
$w("#selectionTags1BD").value =[$w("#selectionTags1BD").value.reverse()[0]]
}