ADD comment Ctrl+Enter

This commit is contained in:
Krivchikov Dmitry 2016-03-21 00:26:29 +03:00
parent 0724236e2e
commit 4c3586b3ea
2 changed files with 9 additions and 1 deletions

View File

@ -13,3 +13,11 @@ function noReply()
$('#answerTo').val(0); $('#answerTo').val(0);
$('#reply').hide(200); $('#reply').hide(200);
} }
$(document).ready(function (){
$('#commentFormTextarea').keydown(function (e) {
if (e.ctrlKey && e.keyCode == 13) {
$('#commentForm').submit();
}
});
})

View File

@ -5,7 +5,7 @@
<span id="replyNick"></span> <span id="replyNick"></span>
<span class="glyphicon glyphicon-remove btn btn-link" onclick="noReply()"></span> <span class="glyphicon glyphicon-remove btn btn-link" onclick="noReply()"></span>
</div> </div>
<form action="/comments/add" method="POST"> <form action="/comments/add" method="POST" id="commentForm">
<input type="hidden" name="answerTo" id="answerTo" value="0" /> <input type="hidden" name="answerTo" id="answerTo" value="0" />
<input type="hidden" name="parentType" value="<?= $parentType ?>" /> <input type="hidden" name="parentType" value="<?= $parentType ?>" />
<input type="hidden" name="parentId" value="<?= $parentId ?>" /> <input type="hidden" name="parentId" value="<?= $parentId ?>" />