Creating a simple page with - 1. A text box 2. A button/link that only works if text box has "x" text

Question:
Im looking to create a custom login page - unrelated to wix members. That has:

  1. A text box
  2. A button/link that only works if that text box contains “x” text.
  3. Ideally, a way to view or receive email when each successful code is entered, so I can track.

Its important for this page to be custom and clean with only these two elements. Thanks in advance, please let me know if unclear!

Im not a coder, so as much detail / code as possible is much appreciated

Product:
Wix Studio Editor

Try this code, replace the IDs of elements

$w.onReady(function () {
    $w("#button").onClick(() => {
        const inputValue = $w("#textBox").value; 
        if (inputValue === "x") { 
            console.log("Correct code entered!");
        } else {
            console.log("Incorrect code.");
        }
    });
});

Just gotta note @Mike_Kenworthy - The code V-Blog uploaded is client-side, it is completely readable by the site visitor. So if this is some kind of secret code, use a web module and run this in the backend

1 Like