Reputation: 27
i want to hide image on clicking a span button but not responding it has a class of close
$('.close').on('click', function(){
$('.img-wrap').empty();
$('#commentfile').val(null);
});
this is the html file
<div class="img-wrap"><span class="close">×</span>
<img id="preview" class="comment-preview mb-1" src="blob:http://localhost/d778f234-1c6f-4145-b9cb-5267cce10e34" alt="...">
</div>
Upvotes: 0
Views: 74
Reputation: 614
Your code works fine when replicated in a codepen, adding in the jQuery CDN. It's likely that the issue stems from you not having jQuery in your project or a poor implementation.
Upvotes: 1