Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
95
rated 0 times [  97] [ 2]  / answers: 1 / hits: 15237  / 12 Years ago, sat, february 25, 2012, 12:00:00

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>

More From » jquery

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


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


[#87215] Friday, February 24, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jarvisjovannia

Total Points: 127
Total Questions: 123
Total Answers: 101

Location: Netherlands
Member since Mon, Jun 7, 2021
3 Years ago
;