Re: Add content to existing div
- From: Joost Diepenmaat <joost@xxxxxxxxx>
- Date: Thu, 04 Sep 2008 20:30:37 +0200
question.boy@xxxxxxxxxxx writes:
I have been trying to find an example of how-to add html text to an
exisiting div and have had little success.
The best I found so far was
var pTag = document.createElement("p");
pTag.innerHTML = noBlanks[i]+" is a mandatory field.";
document.getElementById("FormErrors").appendChild(pTag);
However, I was hoping I could pass HTML code and not just text,
something more like
"New line added.<br />"
or anyother HTML Tag I may need to use.
You can.
Also, the code only seems to work in IE and not Firefox...?
Ther error is somewhere else. This should work in FF; most browsers
support innerHTML, even though it's not officially standard.
--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
.
- Follow-Ups:
- Re: Add content to existing div
- From: question . boy
- Re: Add content to existing div
- From: question . boy
- Re: Add content to existing div
- References:
- Add content to existing div
- From: question . boy
- Add content to existing div
- Prev by Date: hasAttribute equivalent for IE
- Next by Date: Re: Add content to existing div
- Previous by thread: Add content to existing div
- Next by thread: Re: Add content to existing div
- Index(es):
Relevant Pages
|