有发送评论,需要检查div是否为空,如果为空则不发送评论。
$(document).ready(function() {
$(".commen-text").submit(function() {
if($(".KEmoji_Input div").val()=="") {
$(this).remove();
}
});
});
<div class="story-wrap">
<div class="commen-text">
<div style="width: 100%; margin-bottom: 30px; height: 80px !important;" id="{{STORY_ID}}but" onkeyup="postComment($('#{{STORY_ID}}but .KEmoji_Input div').html(),{{STORY_ID}},{{PUBLISHER_ID}},event);"></div>
<p class="hideshow">Введите сообщение...</p>
</div>
<button onclick="postCommentButton($('#{{STORY_ID}}but .KEmoji_Input div').html(),{{STORY_ID}},{{PUBLISHER_ID}},event)" class="send-comm">Отправить</button>
</div>
有一个伪选择器
:empty让它有点不同