0
I’m having a little problem in my append
in the js
I needed to replace one image with another when I click on one div
then when I click the image set via ID some normal but the one that should appear in the place does not appear I needed it to appear in the same place the hidden image follows my code:
$('#lp-pom-image-1674').on('click', function(e) {
$('#lp-pom-image-186').fadeOut('fast', function(){
$('#lp-pom-image-186').append('<img src="http://d9hhrg4mnvzow.cloudfront.net/unbouncepages.com/home- teste/f6ffe5b8-logo-www-outubro.png" class="logo-center-outubro">');
});
});
Notice the code name in the id click event #lp-pom-image-1674
the image with the id #lp-pom-image-186
has to disappear and he disappears normally and in that same id he gives a append
where he would have to place my image inside the img
but it just doesn’t show up it needs to be done that way someone can help me?
Try to give a
$( "#lp-pom-image-186" ).empty();
before theappend
.– BrTkCa
The problem is not because you are giving an append to an element that has just received the . fadeOut? So it becomes invisible and does not appear what was given append.
– Renato Diniz
would look like $('#lp-pom-image-186'). Empty(). append('<img="test">')
– Felipe Henrique
@Renatodiniz So I thought about it and reamente is this if I give an append on another element it works well so it gets in the wrong place it has to stay in the same place that was the image before it understands why I have to use the same id that received the fade
– Felipe Henrique
Then after the append displays the element again
– Renato Diniz
@Renatodiniz with Fade in? is that still learning =3
– Felipe Henrique
@How would Renatodiniz look? this could put as an answer for me to understand better ?
– Felipe Henrique
That, do what the above friend said, first do . Empty(), then append and then a . fadein()
– Renato Diniz
I’ll put it in answer
– Renato Diniz
@Renatodiniz cool if you can do the code so I see how thank you
– Felipe Henrique