Hi, I am trying to trigger an event when a specific tag within a selectionTag is selected.
When “No” is selected in selectionTags6 then it should change to next slide.
It doesn seem to work. Can someone help?
let tags = $w( ‘#selectionTags6’ )
let selectedValues = tags.value;
if (selectedValues=== ‘No’ ) {
$w( ‘#quizSlides’ ).next();
}
Hello.
I would suggest adding an onClick event handler then call next() inside inside the event function.
Good luck!
Hi Sam
Thanks for the response. Could you please elaborate?
let tags = $w( ’ #selectionTags6 ’ )
let selectedValues = tags.value;
selectedValues[0].onClick((event) {
$w( ’ #quizSlides ’ ).next();
})
is not working either. I have tried options as well.
I also tried:
export function selectionTags6_click(event) {
//Add your code for this event here:
if ($w( ‘#selectionTags6’ ).value=== ‘No’ ){
$w( ‘#quizSlides’ ).next();
}
}
without any luck
Please note that selection tag click events are accumulated. In order to check the most recently clicked item you have to return the item at the last position of the accumulation array. See code below:
if($w('#selectionTags6').value[$w('#selectionTags6').value.length - 1] === "No"){
$w('#quizSlides').next();
}
The last item is at the total length of the array minus 1 since array indexes start at 0.
Cheers!