cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

keypress event on textinput

GianVal
15-Moonstone

keypress event on textinput

Hello I want to find a way to implement the following keypress method on text input widget in vuforia studio.

 

var input = document.getElementById("textInput-1");
input.addEventListener("keypress", function(event) {
    if (event.key === "Enter") {
        event.preventDefault();
        document.getElementById("button-5").click();
    }
});

 

 

 

2 REPLIES 2

I think we need to pay attention that event should work also on mobile device - and not only inside chrome

So the Input box have click and value change. So you could every time perform a check  when the event "value change" of the input widget  is fired and then you could try compare the new value of the input widget text with the old (so need to saved after every change the value e.g. to js global variable or to app parameter) the difference will be the added character.

Here some list of events in Studio

Thank you for your reply. Basically, I want to press the enter button of the keyboard to perform a "virtual" click of a search button beside a text input area.

Announcements

Top Tags