Redirect to external url based on dropdown selection

Hi, I saw similar posts from the past on this topic and use the code from those posts. I have a drop down input field, if the input selected is equal to “desiredtext”, then I redirect to a specific external URL, otherwise I redirect to a different url. I’m pretty new to this, could someone please tell me what is wrong with my code?

Thank you very much!

import wixLocation from “wix-location” ;

$w.onReady( function () {
});

export function InputButtonClick(event, $w) {
let option = $w( “#dropdown2” ).value;

if ( option === “desiredtext” ) {
wixLocation.to( “url1” );
} else {
wixLocation.to( “url2” );
}
}

You might find your solution here…
https://russian-dima.wixsite.com/meinewebsite/website-navigation