如何使用jQuery替换div的innerHTML?

我如何实现以下目标:

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

使用jQuery regTitle我的div ID 在哪里

LEYJim2020/03/16 09:53:27

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...

小卤蛋Pro2020/03/16 09:53:27

you can use either html or text function in jquery to achieve it

$("#regTitle").html("hello world");

OR

$("#regTitle").text("hello world");
LSam2020/03/16 09:53:27
$("#regTitle").html("Hello World");