How to replace innerHTML of a div using jQuery?

前端 未结 13 1711
北恋
北恋 2020-11-22 11:57

How could I achieve the following:

document.all.regTitle.innerHTML = \'Hello World\';

Using jQuery where regTitle is my di

13条回答
  •  心在旅途
    2020-11-22 12:33

    jQuery has few functions which work with text, if you use text() one, it will do the job for you:

    $("#regTitle").text("Hello World");
    

    Also, you can use html() instead, if you have any html tag...

提交回复
热议问题