How do i force a comment by pressing enter? At the moment when i press enter it builds a new line. I've seen quite a few articles here on SO but I can't seem to figure it out.
Here's what I've tried:
function enterForm(event) {
if(event.keyCode == 13) {
runForm();
}
}
function enterForm(event) {
if(event.keyCode == 13) {
runForm();
}
}
Adding onKeyUp=”enterForm(event)” in the textarea tag. Didn't work.
I also tried something like this:
$('.cmnt_new').on('keyup', function(e) {
if (e.which == 13 && ! e.shiftKey) {
// your AJAX call
}
});
try keypress as found here:
Submitting a form on 'Enter' with jQuery?
$('.input').keypress(function(e) {
if(e.which == 13) {
jQuery(this).blur();
jQuery('#submit').focus().click();
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With