<td>
<textarea name="message" id="message" rows="1" style="padding: 10px;margin-left: 12px;border-radius: 10px; margin-right: 0px; width: 430px;"></textarea>
<td style="padding-left:0px">
<a title="Send" id="sendButtonId" onclick="return commentsByUser(this)" class="fa fa-location-arrow" href="#"></a>
</td>
</c:when>
<c:otherwise>
我的应用程序中有评论部分,我使用此代码来获取评论,但我无法评论从键盘输入'enter'键,如何为enter键提供访问权限
答案 0 :(得分:1)
您必须将FileInputStream input = new FileInputStream(new File("uinsoaptest.properties"));
props.load(new InputStreamReader(input, Charset.forName("UTF-8")));
个事件绑定到keypress
/ input
textarea
答案 1 :(得分:0)
试试这个。
<script type="text/javascript">
$(document).ready(function() {
$('.submit_on_enter').keydown(function(event) {
if (event.keyCode == 13) {
this.form.submit();
return false;
}
});
});
</script>
&#13;
<form action="path_to_the_action">
<input class="submit_on_enter" onclick="return commentsByUser(this)">
</form>
&#13;
答案 2 :(得分:0)
$(document).keypress(function (e) {
if (e.which == 13) {
alert('Enter key pressed');
$('#sendButtonId').trigger('click');
}
});
$('#sendButtonId').click(function(e) {
// call ur function here...
});