Why does span tag under div disappear when jQuery refreshes div data
$(document).ready(function() {
setInterval(function() {
$.get("temp.php", function(temp) {
$("deneme span").html(temp);
$("#deneme").html(temp);
});
}, 3000);
});
<div class="container">
<div class="de">
<div class="den">
<div class="dene">
<div class="denem">
<div class="deneme" id="deneme">
<span></span><strong>°</strong>
</div>
</div>
</div>
</div>
</div>
</div>
</center>
+3
source to share
2 answers
Just a shot in the dark: (more code will help)
$("deneme span").html(temp);
I noticed that you have included the tag <span>
above.
Remove the tag <span>
i.e. $("deneme")
if you don't want this to be done with.html(temp);
After you've done this, try adding display:inline-block;
to the element <span>
for more stability to prevent the position from moving when the element is moved higher.
+1
source to share