How to delete specific class after seat deletion return

Asked

Viewed 14 times

0

I’m trying to eliminate a class after deletion in bank, in the script I had deleted li with this line here in my code:

$el.parents('li').remove();

But my need is another, when returning from a deletion I need to eliminate the class that has the image displayed to the customer, but I have no knowledge in JQuery to accomplish what I need, even searching.

<div class="masonry-gallery columns-5 clearfix">
<a class="image-hover lightbox" href="<?php echo $ImagemArquivo->Caminho; ?>" data-plugin-options='{"type":"image"}'>
    <span class="image-hover-icon image-hover-dark">
        <i class="fa fa-search-plus"></i>
    </span>
    <img src="<?php echo $ImagemArquivo->Caminho; ?>" alt="...">                            
</a>
<button name="btnExcluir" idcooperadoarquivo="<?php echo $ImagemArquivo->IdCooperadoArquivo; ?>" cpf="<?php echo $ImagemArquivo->CPF; ?>" class="btn" type="button" >Excluir</button><br />
    <div class="alert alert-warning margin-bottom-30">
        Nenhum arquivo para exibição.
    </div>

What I tried to do:

function(response){                                     
if (response.codigo == "0") {                               
        $("#msgResult").html('×Close' + response.mensagem  + '');   
            // OCULTANDO A MENSAGEM DE ERRO E REDIRECIONANDO
            window.setTimeout(function() {
                $(".alert").fadeTo(300, 0).slideUp(300, function(){
                    $(this).remove();   
                    window.location.href = "iGaleria.php"; 
                });
            }, 3000);                                       
    }                                       
}); 
// TENTEI REMOVER A CLASS DESSA FORMA
$(this).closest(".masonry-gallery").remove();

  • 1

    Have you tried using removeClass? $("div"). removeClass("masonry-gallery");

  • Are you trying to remove the class from an element or the elements that contain the class? If the goal is to remove the element, the problem may be in the this of the line $(this).closest(".masonry-gallery").remove();, for this line to work this expected to be an element contained within masonry-gallery

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.