Ahmed Mohamed Ahmed Mohamed - 6 months ago 16
HTML Question

On click remove div with js

If i click on X it will delete div:



$('#close').on('click', function(){
$(this).closest('div').remove();
})

<div class="single_add">

<i id="close" class="fa fa-times-circle">X</i>

ads

</div>





The code working in jsfiddle

http://jsfiddle.net/Ny346/161/

But it's not working when I upload it on my server

http://www.bohgames.com/js.html

What is the problem ?

Answer
<div class="single_add">

<i id="close" class="fa fa-times-circle" onclick="this.parentElement.style.display = 'none';">X</i>

ads

</div>
Comments