K
K
KoRNeT46RuS2019-04-12 16:57:09
JavaScript
KoRNeT46RuS, 2019-04-12 16:57:09

How to make a line break on shift + enter, while leaving the form submit on enter?

enter - form
submission shift+enter - line break.
Tried

element.on('keypress', (_event) => {
if (_event.shiftKey && (_event.keyCode===13)) {
                              
                                message += '\r\n';
                               
                            } else if(_event.keyCode===13) {
                                element.closest('form').submit();
                            }
}

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vladimir Proskurin, 2019-04-12
@Vlad_IT

S
Stalker_RED, 2019-04-12
@Stalker_RED

Add with shift+enter evt.preventDefault()

A
Artyom, 2017-02-15
@SlampD

Will look at you from the tray.

I
iBird Rose, 2017-02-15
@iiiBird

if you have a video call - how you want to see if the skype application is not closed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question