smulholland2
smulholland2

Reputation: 1163

document.write in IE

I haven't checked with IE9 but I have a simple JS that utilizes document.write to display some information. It works on every browser except IE 6, 7, 8. I checked all my other code and when I decided to eliminate all of it and simply put

document.write(Testing);

I got nothing from IE. Is there another command I can use. I am new to Javascript.

Upvotes: 0

Views: 5257

Answers (3)

CaptainJanuary
CaptainJanuary

Reputation: 61

We were having this problem earlier today and luckily our page already had access to jquery...

Replacing document.write(variableWithYourValue) with $('html').html(variableWithYourValue) did the trick for us.

Upvotes: 1

Joshua Carmody
Joshua Carmody

Reputation: 13730

I'm not sure how your original code is using document.write, but you could achieve more or less the same effect this way:

<div id="outputGoesHere"></div>
<script type="text/javascript">
    document.getElementById("outputGoesHere").innerHTML = "Testing";
</script>

Upvotes: 4

Naftali
Naftali

Reputation: 146302

try: document.write('Testing');

Upvotes: 3

Related Questions