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();
Have you tried using removeClass? $("div"). removeClass("masonry-gallery");
– Bruno
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
thisof the line$(this).closest(".masonry-gallery").remove();, for this line to workthisexpected to be an element contained withinmasonry-gallery– mauricio-andre