1. ホーム
  2. javascript

[解決済み] How to append text to a `<div>`?

2022-03-21 12:20:13

Question

I’m using AJAX to append data to a <div> element, where I fill the <div> from JavaScript. How can I append new data to the <div> without losing the previous data found in it?

How to solved?

Try this:

var div = document.getElementById('divID');

div.innerHTML += 'Extra stuff';