- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
innerHTML adds text but not HTML tags
Maybe, you are using += with innerHTML. Try the following:
var myNum = [1,2,3]; var myStr; myStr = "<ul>"; for( var a in myNum) myStr += "<li>" + a + "</li>"; myStr += "</ul>"; id("numberList").innerHTML = myStr;
- Related Articles
- How do you make a button that adds text in HTML ?
- HTML DOM innerHTML Property
- HTML Deprecated Tags
- Disable browser caching with meta HTML tags
- Do you need text/javascript specified in your tags?
- Where should I put tags in HTML markup?
- What is the difference between HTML tags and ?
- Remove and add new HTML Tags with JavaScript?
- Should I include type=“text/javascript” in my SCRIPT tags?
- Are button HTML tags outside of a form valid?
- Are HTML comments inside script tags a best practice?
- What are the essential tags for an HTML Document?
- How to remove HTML Tags with RegExp in JavaScript?
- How to remove html tags from a string in JavaScript?
- What are the most important tags for an HTML Document?

Advertisements