This would appear to be simple and I’m sure it’s a syntax thing.
I’ve got 5 radio buttons, #radioGroup1. I’d like when the user selects the correct answer for the “I agree” button to expand - so far, so good.
If they choose the wrong answer I’d like the “I agree” button to stay hidden and the page to scroll to the top so they can read it again. My issue is that when they choose the right answer the page scrolls to the top also.
import wixWindow from ‘wix-window’ ;
$w . onReady ( function () {
registerHandlers ();
});
function registerHandlers ( ) {
$w ( ‘#radioGroup1’ ). onClick (() => submitButton ());
}
function submitButton ( ) {
let myValue = $w ( “#radioGroup1” ). value ;
console . log ( myValue );
if ( myValue === “4” ){
$w ( ‘#iagree’ ). expand ()
$w ( ‘#text26’ ). expand ()
} else {
$w ( ‘#iagree’ ). collapse ()
$w ( ‘#text26’ ). collapse ()
wixWindow . scrollTo ( 0 , 0 )
}
Any ideas?
Regards,
Andrew