Change content of a div using JavaScript

前端 未结 4 1371
萌比男神i
萌比男神i 2020-12-10 04:06

How to dynamically change content of a div using JavaScript?

4条回答
  •  半阙折子戏
    2020-12-10 04:32

    document.getElementById("divId").innerHTML = "new content!"

    I would recommend using a framework like jQuery though, because chances are you will be doing more things like this later.

提交回复
热议问题