a debugger to let me see the innerHTML of a div?

J

Jake Barnes

What debugger would let me see the HTML in a div after I've added HTML
to the div using its innerHTML? That is:

var someInputHtml = prompt("input html");
var referenceToSomeDiv = document.getElementById("someDiv");
referenceToSomeDiv.innerHTML = someInputHtml;

When debugging, how do I now see what HTML is in the div "someDiv"?

Maybe there is a FireFox extension for this? Firebug?
 
R

Randy Webb

Jake Barnes said the following on 9/29/2006 1:36 AM:
What debugger would let me see the HTML in a div after I've added HTML
to the div using its innerHTML? That is:

var someInputHtml = prompt("input html");
var referenceToSomeDiv = document.getElementById("someDiv");
referenceToSomeDiv.innerHTML = someInputHtml;

When debugging, how do I now see what HTML is in the div "someDiv"?

alert(referenceToSomeDiv.innerHTML)

Or, you could replace the < with &lt; and > with &gt; and then insert it
into a separate debugging div.
 
E

Evertjan.

Randy Webb wrote on 29 Sep 2006 in comp.lang.javascript:
Jake Barnes said the following on 9/29/2006 1:36 AM: [..]
When debugging, how do I now see what HTML is in the div "someDiv"?

alert(referenceToSomeDiv.innerHTML)

Or, you could replace the < with &lt; and > with &gt; and then insert it
into a separate debugging div.

Why the latter?

referenceToOtherDiv.innerHTML =
'<pre>' +
referenceToSomeDiv.innerHTML.replace(/</g,'&lt;') +
'</pre>';

should work fine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top