Forum Discussion

jonathanw's avatar
jonathanw
Community Member
5 days ago
Solved

Jump to next slide on entering correct text into a text entry field

Sorry, I know this has been discussed before but I cannot find the thread.

I am creating a software simulation where the module needs to move to next slide immediately on entering the correct text into the text entry field. For example. when user types 'north', it moves to next slide.

I understand that this will require JavaScript and triggers, but I cannot figure it out how to make it work.

Any advice would be greatly appreciated as the alternative is moving to captivate.

  • Try this simple code and ensure the triggers are replicated as shown below. I’ve attached a story file just in case.

    const input = document.querySelector(".acc-textinput");
    setVar("TextEntry", "");
    input.addEventListener("keyup", () => {
      setVar("TextEntry", input.value.trim().toLowerCase());
    });

     

     

2 Replies

  • Nedim's avatar
    Nedim
    Community Member

    Try this simple code and ensure the triggers are replicated as shown below. I’ve attached a story file just in case.

    const input = document.querySelector(".acc-textinput");
    setVar("TextEntry", "");
    input.addEventListener("keyup", () => {
      setVar("TextEntry", input.value.trim().toLowerCase());
    });