i have this css which makes div unclickable
.commentpost{
pointer-events: none;
}
with this html
<div class="commentsDiv">
//some code to show the comments from db
//
<div class="w-100">
<div class="div-bottom-3 d-flex " style="position: absolute;">
<div class="form__group">
<input type="text" class="form__input comment" id="comment"
placeholder="Add a comment" name="comment"/>
</div>
<div class="pt-1 commentpost">
Post
</div>
</div>
</div>
</div>
and this jquery
$(document).ready(function(){
// makes commentpost div clickable if input is not empty
$('.comment').keyup(function() {
$('.commentpost').css('pointer-events','auto');
if(!$.trim($('.comment').val()).length){
$('.commentpost').css('pointer-events','none');
}
$('.commentpost').on('click',function(e){
//ajax call happens
//and on success reload div commentsDiv with .load()
})
});
after ajax success it saves the comment in db and shows it in another div but I cant press the post div again, pointer-event stays none