Forum Discussion
NancyHyde-35f43
2 months agoCommunity Member
Using Javascript to catch typing in text box
On the second screen in the attached file, I want to have the user type "Item L2" in the text entry box and have the program immediately jump to the next screen without having to click away from the ...
NancyHyde-35f43
2 months agoCommunity Member
I got it working! I used a single Javascript that executes when the timeline starts:
const Inputs = () => {
var myInputs = document.querySelectorAll('input[type="text"]');
myInputs.forEach(function(input, index) {
input.addEventListener('keyup', function(event) {
var str = input.value;
var player = GetPlayer();
//Create a RegExp object using the constructor
let regex = new RegExp(str);
let text = "Item L2";
// Test if the regex matches the text
let searchGood = regex.test(text);
player.SetVar("Correct_Value", searchGood);
player.SetVar("TextEntry44", str);
});
});
};
setTimeout(Inputs, 100);
Then, I had the remaining triggers set to "when TextEntry44 changes"
Related Content
- 3 months ago