代码示例:(标识:eg_js_jquery_sethtml)
<!DOCTYPE html>
<html>
<head>
<script src="/jquery/jquery.min.js"></script>

</head>
<body>

<h1>设置 HTML</h1>

<div id="01">
  <h2>Hello China!</h2>
</div>
<div id="02">
  <h2>Hello World!</h2>
</div>

<p id="demo"></p>

<script>
$(document).ready(function() {
  var myElement = $("#02");
  myElement.html("<h2>Hello Shanghai!</h2>");
});
</script>

</body>
</html>
运行结果: