473,379 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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

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?

Sep 29 '06 #1
5 1753
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.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Sep 29 '06 #2

"Jake Barnes" <lk******@geocities.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
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"?
Most would.

Mine is here (with complete documentation and examples):

http://www.depressedpress.com/Conten...sions/DP_DeBug

Using your example you would call it like:
DP_Debug.dump(referenceToSomeDiv.innerHTML);

This is a JavaScript-only tool (no install) and works in FireFox, IE and
Opera 9. A Tool like Firebug offers significantly more functionality at the
cost of an install and browser specificity.

Jim Davis
Sep 29 '06 #3
Jake Barnes wrote:
What debugger would let me see the HTML in a div after I've added HTML
to the div using its innerHTML? That is:
Maybe there is a FireFox extension for this?
DOM Inspector
Firebug?
Has a built in DOM Inspector, I don't like it as much as the original.

--
David Dorward <http://blog.dorward.me.uk/ <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Sep 29 '06 #4
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.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 29 '06 #5
Jake Barnes wrote:
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?
Perhaps this might help
innerHTML.split("&").join("&amp;").split("<").join ("&lt;").split(">").join("&gt;")
Sep 29 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Jeff | last post by:
Use the MS Script Editor included free with MS Office 2002 and above, for debugging Internet Explorer (IE). This subject is of great interest to many JS developers, as there is no obvious, low...
4
by: RobG | last post by:
I know you aren't supposed to use innerHTML to mess with table structure, but it seems you can't use it just after a table without damaging the containing element. I added a table to a div using...
3
by: mikeorb | last post by:
I'm debugging some JavaScript. In Firefox I can use dump(msg) to print a message on their JS console (see http://kb.mozillazine.org/Viewing_dump()_output). Likewise, Opera has the...
9
by: Hallvard B Furuseth | last post by:
Why does the FAQ (Q 4.15) recommend innerHTML when so many here say one should use createElement(), replaceChild() etc? Also, why does the "Alternative DynWrite function" at...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.