每當我按下Enter鍵,我都會在Firefox和Internet Explorer中看到一個ReferenceError。有誰知道如何解決這個問題嗎? :)ReferenceError:未定義事件
function status_post_comment(id) {
if(event.which == 13 && !event.shiftKey) {
var check_comment = $.trim($('#status_comment_'+id).val());
var comment = $('#status_comment_'+id).val();
if(check_comment.length >0) {
$.ajax({
type: 'POST',
url: '<?php echo $domain; ?>social/comment_ajax.php',
data: 'id='+id+'&comment='+comment,
success: function(result) {
$('#append_comment_status_'+id).append(result);
$('#status_comment_'+id).val('');
$(".timeago").timeago();
$('.comment_input').val('');
}
});
}
}
}
也許你的函數應該是這樣的:function status_post_comment(id,event){ – aquinas 2014-09-05 17:59:00
你在哪裏使用函數 – Satpal 2014-09-05 17:59:17
'event'沒有被定義,所以定義它!就那麼簡單。 – 2014-09-05 18:04:31