Typecho Comment Add Ctrl+Enter Quick Reply Jquery Upgrade

 Typecho Comment Add Ctrl+Enter Quick Reply Jquery Upgrade

Typecho was used six years ago (a long history). The default comment does not support ctrl+enter to submit comments. At that time, the processing method was to directly modify the html and add code:

onkeydown="if(event.ctrlKey&&event.keyCode==13){document.getElementById('misubmit').click();return false};"

See the history article for details《 How to add Ctrl+Enter quick reply to Typecho comments

Then I didn't know when to start, but I made an upgraded version. At that time, I forgot to refer to whose code, and changed it to:

function key_submit(){

if(window.event.ctrlKey && event.keyCode==13){

document.comment_form.submit();

}

}document.onkeydown=key_submit;

Then until today, another upgrade was carried out.

$('form[id=comment_form]').keypress(function(e){

if(e.ctrlKey && e.which == 13 || e.which == 10) {

$('#misubmit').click();

}

});

The replacement of the corresponding ID is as simple as that.

Appreciation

see jquery Typecho Related articles for

Please specify that the original article of this website is reproduced from To be kicked , Link: https://103.126.210.91/articles/2304.html

Comment list (4)

  1. reply Tikezhi Tikezhi

    Actually, I really want to comment. I don't mind clicking the mouse more

    1. It is convenient to submit comments quickly

      1. This function is really practical. Some people can use the keyboard and never use the mouse. After all, keyboard operation is more efficient than mouse operation~

        1. Yes, I myself sometimes submit quickly

Add a comment

Hello! #Please fill in the information# determine

Reward the blogger for drinking water
 LOADING