Hello,
I have an input filed on my page, I want when someone enters the number '182042' will be redirected to 'www.passarmenia.com/admin-students'
And if they enter incorrect numbers a fail text will show.
Please, can someone give me the code for this?
Thanks in advance,
Arman
Lets say we have a text component with id='#text1' and a button with id='#button1'
You'd like to have something like this:
import wixLocation from 'wix-location'; // ... export function button1_click(event, $w) { if ($w('#text1') === '182042') { wixLocation.to("/admin-students") } else { //show a fail text } }
Dear Eli Yadgar,
It is working as wanted. Thank you very-very much!!!
Please can you give me the code for this time?
Hi,
You can use 'if' statement for verifying the inserted text, and then use 'wix-location' for the url navigation.
You can find here an example for 'wix-location' usage.
Please let me know if you need help