257
Views
4
Comments
Reactive onkeypress event by Enter key in input fields
Question
Application Type
Reactive
Service Studio Version
11.54.54 (Build 63219)

I want to trigger an action using Enter key in my onkeypress event

2022-07-11 14-05-36
Jeroen Barnhoorn
UserImage.jpg
sierra

Hi Jeroen Barnhoorn,

I tried it and it works. However, it says that it is deprecated, would it be a problem in the future?

2022-07-11 14-05-36
Jeroen Barnhoorn

Would it be a problem? Probably not, at least not for the foreseeable future. 
However, it would indeed be better to use keydown and key instead:

document.addEventListener('keydown', function enterPress(e) {        
    if(e.key == 'Enter') {                
        $actions.ScreenAction();        
    }
});

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.