Use insertAdjacentHTML
which is supported in all current browsers:
div.insertAdjacentHTML( 'beforeend', str );
The position parameter beforeend
will add inside the element, after its last child.
Live demo: http://jsfiddle.net/euQ5n/
More Related Contents:
- How can I tell if a DOM element is visible in the current viewport?
- Why does JavaScript navigator.appName return Netscape for Safari, Firefox and Chrome?
- How to reduce the length of a video using JavaScript? [closed]
- Trying to use Javascript to add new li element to my ordered list, anyone know why this code isn’t working?
- Do DOM tree elements with IDs become global properties?
- Changing website favicon dynamically
- Dynamically set value of a file input [duplicate]
- Browser/HTML Force download of image from src=”data:image/jpeg;base64…”
- Best Practice: Access form elements by HTML id or name attribute?
- Difference between Node object and Element object?
- Why are duplicate ID values not allowed in HTML?
- HTML “overlay” which allows clicks to fall through to elements behind it [duplicate]
- JavaScript get element by name
- Is there a DOM event that fires when an HTML select element is closed?
- Why is the variable holding the input value always logged as empty?
- How do I put codes from jsfiddle.net into my website?
- Focus Input Box On Load
- Screen Scraping from a web page with a lot of Javascript [closed]
- Attach event listener through javascript to radio button
- Is there a flexible way to modify the contents of an editable element?
- Open new window without focus on it [duplicate]
- display HTML page after loading complete
- Is there a way to get innerText of only the top element (and ignore the child element’s innerText)?
- window.getSelection return html [duplicate]
- How to properly unload/destroy a VIDEO element
- How to get on-screen visible element objects in jQuery? [duplicate]
- How can I detect a Scrollbar presence ( using Javascript ) in HTML iFrame?
- How to get element by class name
- Test if an element can contain text
- Replacement for deprecated `keypress` DOM event