Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery remove div not working in Internet Explorer

I'm not really a javascript/jquery coder, I have a very simple code to remove a div that's not working in IE

I'm using this in a Joomla page, so I call it like this:

$document->addScript("http://code.jquery.com/jquery-latest.js");//adiciona jquery

And than, in the body document:

<script>
    setTimeout(function() {
        $("#yourDiv").remove();
    }, 50000);
</script>

FireFox and Chrome are (as always) ok. Can someone point out my mistake please? Thanks a lot :)

EDITED ************

I've tryied also with this code no jquery, but always not working in IE (9)

<script>
setTimeout('yourFunction();', 5000);
function yourFunction(){
var div = document.getElementById("yourDiv");
div.parentNode.removeChild(div);
}
</script>
like image 519
Adry Avatar asked Dec 17 '22 03:12

Adry


1 Answers

<script>
$(document).ready(function(){
    setTimeout(function() {
        $("#yourDiv").remove();
    }, 50000);
});
</script>

Check this fiddle, it's working in ie too.

like image 93
The Alpha Avatar answered Dec 28 '22 07:12

The Alpha