I have put a code and that is working properly in preview but is not working on Live website. Please anyone help.
My code:
import wixLocation from 'wix-location'; // Navigation const nextPage = () => { wixLocation.to("/home-1"); }; $w.onReady(function () { const button = $w('#Enterbutton'); const focusTrap = $w('#input1'); button.onClick(() => { nextPage(); }); focusTrap.onKeyPress((event) => { if (event.key === 'Enter') { nextPage(); } }); // Focus trap. // If user click somewhere then we return the focus to input focusTrap.onBlur(() => { setTimeout(() => { focusTrap.focus(); }, 100); }); focusTrap.focus(); });
Hi Saksham, did you publish? :P i tried the code and it works fine. Clikking button sends me to home (Be Sure home is really home-1) Pressing enter in the text field also sended me to home Trying to get out of the text field keeps focusing back on that field.